Setting up Apachy2, Mysql and PHP on my Kubuntu installation.
Start with installing all the packages:
sudo apt-get install apache2 mysql-server php phpmyadmin
Configure Apache2 home directories
In Apache it's possible to allow users to host a site from their own home directory, the default is ~/public_html. For this enable the userdif mod, make the directory, set the directory access rights, enable php (follow the directions in the config file) and restart apache:
sudo a2enmod userdir mkdir ~/public_html chmod 755 ~/public_html sudo nano /etc/apache2/mods-enabled/php7.4.conf sudo systemctl restart apache2
Setting up phpmyadmin
While installing phpmyadmin there is a question to choose a webserver to configure. Apache2 is highlighted but should be selected (space) and there should be an asterisk. When this was forgotten it can be reinstalled. However, to trigger the configuration of the database, all the config files should also be removed.
sudo apt-get purge phpmyadmin sudo apt-get install phpmyadmin sudo systemctl restart apache2
By default mysql has no password for root and phpmyadmin doesn't allow logging in without a password. So a password for mysql has to be set:
sudo mysql mysql> ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY 'password' mysql> exit
phpMyAdmin can now be reached by http://localhost/phpmyadmin with username root and the new password.
Setting up akonadi to the new sql database
Akonadi is a personal information management software which uses a mysql database. On my system after installing mysqld, akonadi stopt working. It is possible to reconfigure akonadi so it uses the new mysqld.
In ~/.config/akonadi/akonadiserverrc set:
[QMYSQL] Host=localhost Name=akonadi Options="UNIX_SOCKET=/var/run/mysqld/mysqld.sock" ServerPath=/usr/sbin/mysqld StartServer=false
Then add the required user and database to mysql:
sudo mysql -p mysql> CREATE USER USER@localhost IDENTIFIED WITH auth_socket; mysql> CREATE DATABASE akonadi; mysql> GRANT ALL PRIVILEGES ON akonadi.* TO USER@localhost; mysql> FLUSH PRIVILEGES; mysql> exit akonadictl restart