Disclaimer: This article is a memo. I wrote it mostly for myself as I often am doing all of these and always have to be sure I didn’t forget anything in the process.
First of all, login under superuser account. Don’t worry, in Ubuntu, system will create Apache it’s own user, www-data.
Then let us go:
Installing apache is ridiculousely easy:
apt-get install apache2
After that you should be able to see the default apache2 page on your server IP adress. In Ubuntu, the web root of the apache2 webserver should be under
/var/www/html and config under `/etc/apache2/apache2.conf’.
Also if you need SSL – use
a2enmod ssl and
a2ensite default-ssl. The location of certificate now is
/etc/ssl/certs/ssl-cert-snakeoil.pem, the config should be at
apt-get install php libapache2-mod-php
After PHP is installed you can also install some modules for it. You can search all the modules available from repo via
apt-cache search php-. All I need most times is shipped with debian’s PHP version already, but additionally I usually install APC User Cache and Image Magic:
apt-get install php-apcu php-imagick
You can now rename index.html in apache dir to index.php and put some php there. For example,
<?php phpinfo();?> and restart apache via
systemctl restart apache2 to test if your php works.
apt-get install mariadb-server mariadb-client
Then run the script:
As it says, “running all parts of this script is recommended on all production servers”. Go through all parts of the script to setup MariaDB root password and stuff. You can now test your MariaDB using
mysql -u root -p command. Enter the password and if a prompt like
MariaDB [(none)]> then everything is fine.
apt-get install phpmyadmin
NOTE that in the process apt will ask you about web server it should configure automatically for. The options there are checkboxes and to select a webserver (presumeably apache) you have to select one of those by pressing spacebar.
After that phpmyadmin should be available under
If you want to login to your phpmyadmin from root – you may want to disable unix_socket plugin from that user, added in MariaDB by default. To do so login in mysql:
mysql -u root -p
And then run couple commands in query interface:
UPDATE user SET plugin='' WHERE User='root'; FLUSH PRIVILEGES; EXIT;