Install apache, mysql, php with phpmyadmin and adminer (Ubuntu 14 and above)
Open your terminal by opening the dash (Using the Super/Windows key) and typing “terminal”, then type:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client
You will be asked to select a root username and password; I usually type “root” for both, so it’s easy to remember. Don’t do this on a server ;)
sudo apt-get install apache2
Now by visiting http://localhost with your browser you should see an Apache 2 Ubuntu Default Page. Well done.
Let’s also make sure an important module for Apache is active (the one that rewrites URLs, useful for pretty permalinks)
sudo a2enmod rewrite
sudo apt-get install php5 libapache2-mod-php5 php5-mysql
Remember that in Ubuntu by default your local php webpages need to be uploaded in the /var/www
folder. We’ll be changing this later, so that you can have a folder in your home folder and make it work just the same.
Then, just to be safe, restart the Apache2 server:
sudo systemctl restart apache2
sudo apt-get install phpmyadmin
You will be prompted like this:
Just press spacebar and using tab highlight Ok, then press Enter
(note that in this case it is not strictly needed to press spacebar and tab, we could just press enter, but now you know how to navigate these dialogs)
In the next screen, also press Enter…
And in the following screens, enter the mysql username and password you’ve chosen earlier (in my case, they both are root)
Again, just to be sure, once the installation is finished you can restart the server.
sudo systemctl restart apache2
Now, if you go to http://localhost/phpmyadmin, you should see the familiar page.
Please read this section in Ubuntu wiki. You will need to configure your apache2.conf to make phpMyAdmin works.
gksu gedit /etc/apache2/apache2.conf
Then add the following line to the end of the file.
Include /etc/phpmyadmin/apache.conf
Then restart apache
sudo systemctl restart apache2
As I wrote above, we are going to use a home folder for PHP development. This way we don’t need to mess with permissions for the /var/www
folder.
Let’s do it, it’s simple! First of all, let’s create a new folder. Open your terminal , and type:
mkdir ~/Workspace
Once done, let’s make this folder available for Apache
cd /etc/apache2/sites-available
then
ls
This way we can see the content of the folder, which should be:
000-default.conf
Let’s open that file using the Nano terminal text editor, like so:
sudo nano 000-default.conf
Or, if you prefer a graphical text editor and you’re using Ubuntu, you can open the file with Gedit, like so:
sudo gedit 000-default.conf
Let’s delete this document’s content and replace it with the following (IMPORTANT: replace “relizont” with your home folder name)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/relizont/Workspace
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
<Directory /home/relizont/Workspace>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
Now, let’s restart the machine, just to make sure :). You can do it from Terminal by typing sudo reboot
Once restarted, go to your /Workspace folder and create an empty file, called info.php. Inside, type;
Then, check out your file by going to http://localhost/info.php!
sudo apt-get install adminer
Now Adminer should run on http://127.0.0.1/adminer/
But unfortunately, for same reason don`t run...
Then you will need to configure your apache2.conf to make adminer works.
gksu gedit /etc/apache2/apache2.conf
Then add the following line to the end of the file.
Include /etc/adminer/apache.conf
Then restart apache
/etc/init.d/apache2 restart
sudo apt-get install ruby
sudo gem install sass
This is the “easy” way to install ruby, and it’s fine if you don’t plan to use Ruby on Rails. If you do, follow this tutorial instead. You can check that they indeed work by typing the following commands (you should get a version number as a response):
ruby -v
sass -v
sudo apt-get install git
and to check that it’s working:
git --version