Run mysql_secure_installation to secure MariaDB. You will be given the option to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases and reload privileges. It is recommended that you answer yes to these options:

1

mysql_secure_installation

Create a MySQL/MariaDB Database

Log in to MariaDB:

1

mysql -u root -p

Enter MariaDB’s root password. You will get the MariaDB prompt.

Create a new database and user with permissions to use it:

1
2

create database webdata;
grant all on webdata.* to 'webuser' identified by 'password';

In the above example webdata is the name of the database, webuser the user, and password a strong password.

Exit MariaDB

1

quit

With Apache and MariaDB installed, you are now ready to move on to installing PHP to provide scripting support for your web pages.

PHP

Install and Configure

Install PHP:

1

sudo yum install php php-pear

If you wish to install MySQL support for PHP also install the php-mysql package:

1

sudo yum install php-mysql

Edit /etc/php.ini for better error messages and logs, and upgraded performance. These modifications provide a good starting point for a Linode 2GB: