As we know that “LAMP” Stack is a bunch of open source software which is installed together to set up a server to host the web applications and websites. By doing this installation you can process the content by PHP and stored the data into the MySQL Database.
By following this guide you can install LAMP Stack on an Ubuntu 14.04 and 16.04 the Linux operating system.
Install Apache 2.4
Please note: This works fine. But this package will also upgrade your apache version 2.4
which has different config files in apache 2.2 and also deletes stuff, like
/etc/apache2/sitesavailable/default when upgrading. This may result in a loss of your apache settings (vhost, mod_rewrite stuff etc.). Be aware of that!
$ sudo apt-get update $ sudo apt-get install -y apache2 apache2-doc apache2-utils
Install PHP 5.6 on Ubuntu
Use the following set of command to add PPA for PHP 5.6 in your Ubuntu system and install PHP 5.6.
$ sudo apt-get install -y python-software-properties $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get install -y php5.6 php5.6-mysql php5.6 php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mcrypt php5.6-xml php5.6-xmlrpc
Check Installed PHP Version:
$ php -v
Install PHP 7.1 on Ubuntu
Use the following set of command to add PPA for PHP 7.1 in your Ubuntu system and install PHP 7.1.
$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get install -y php7.1
Switch Between PHP Versions
If you have installed multiple PHP versions and want to use differently than the default. Use following steps to switch between php5.6 and php7.1 version. You can use the same command for other PHP versions by just changing PHP version in command.
From PHP 5.6 => PHP 7.1
$ sudo a2dismod php5.6 $ sudo a2enmod php7.1 $ sudo service apache2 restart
$ update-alternatives --set php /usr/bin/php7.1
From PHP 7.1 => PHP 5.6
$ sudo a2dismod php7.1 $ sudo a2enmod php5.6 $ sudo service apache2 restart
$ sudo update-alternatives --set php /usr/bin/php5.6
Install MySQL Server:
There are two ways to install MySQL. You can either use one of the versions included in the APT package repository by default (which are 5.5 and 5.6), or you can install the latest version (currently 5.7) by manually adding MySQL’s repository first.
If you want to install a specific version of MySQL, follow the appropriate section below. To help you decide which version is best for you, you can read MySQL’s introduction to MySQL 5.5, then what’s new in MySQL 5.6 and what’s new in MySQL 5.7.
If you’re not sure, you can just use the mysql-server APT package, which just installs the latest version for your Linux distribution. At the time of writing, that’s 5.5, but you can always update to another version later.
To install MySQL this way, update the package index on your server and install the package with apt-get
$ sudo apt-get update $ sudo apt-get install -y mysql-server
You’ll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it because you’ll need it later. Move on to step two from here.
Installing MySQL 5.5 or 5.6
If you want to install MySQL 5.5 or 5.6 specifically, the process is still very straightforward. First, update the package index on your server.
$ sudo apt-get update
Then, to install MySQL 5.5, install the mysql-server-5.5 package.
$ sudo apt-get install -y mysql-server-5.5
To install MySQL 5.6, install the mysql-server-5.6 package instead.
$ sudo apt-get install -y mysql-server-5.6
For both options, you’ll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it because you’ll need it later.
Installing MySQL 5.7
$ wget http://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
Next, install it using dpkg.
$ sudo dpkg -i mysql-apt-config_0.8.8-1_all.deb
You’ll see a prompt that asks you which MySQL product you want to configure. The MySQL Server option, which is highlighted, should say mysql-5.7. If it doesn’t, press ENTER, then scroll down to mysql-5.7 using the arrow keys, and press ENTER again.
Once the option says mysql-5.7, scroll down on the main menu to Apply and press ENTER again. Now, update your package index.
$ sudo apt-get update
Finally, install the mysql-server package, which now contains MySQL 5.7.
$ sudo apt-get install -y mysql-server
You’ll be prompted to create a root password during the installation. Choose a secure one and make sure you remember it, because you’ll need it later.
To Check mysql Version :
$ mysql --version
$ sudo apt-get update $ sudo apt-get install -y phpmyadmin
First enable rewrite using this command:
$ sudo a2enmod rewrite
Then restart apache2:
$ sudo service apache2 restart
Install Sublime Text 3:
$ sudo add-apt-repository -y ppa:webupd8team/sublime-text-3 $ sudo apt-get update; sudo apt-get install -y sublime-text-installer
To install Subversion, run the following command from a terminal prompt:
$ sudo apt install subversion apache2 libapache2-svn
$ sudo apt-get install filezilla
Now I hope you have Installed LAMP Stack properly, You should confirm your web server’s connection are secured or note via HTTPS. Otherwise, you can use TLS/SSL Certificate for Encryption to secure your websites.
If this blog helps you for open source development so please share this blog on social media and also with your friends.