Installing WordPress can be quite easy and runs on even the smallest server. So it can make sense to start with the minimum and get bigger and bigger the more success you have with your website or blog. The easiest way to install WordPress is via control panels. However, since these are not available everywhere, you will often find yourself in the situation of having to manually get WordPress onto the server. These are the most important steps. We assume that no software is installed on the server yet. First, we install the web server. In this case, an Apache2 server that takes care of delivering the files generated with PHP. Next, we need to make sure that PHP, the programming language WordPress is written in, is also installed on the server.
php:install Install PHP.
$ apt-get install php
try on your machine
explain this command
In order for the blogposts and pages to be stored, a database must be provided. We recommend MySQL, which has worked stably with WordPress for many years.
mysql:install Install a MySQL database server.
$ apt-get install mysql-server
try on your machine
explain this command
Once the database server has been created, we need to create the database for WordPress.
wordpress:database:create Create the database for the WordPress installation
$ mysql -e "CREATE DATABASE ${database_name};" ${password};
try on your machine
explain this command
After that, we create a user with the necessary permissions that we can use later when installing WordPress.
wordpress:database:user:create Create the user (with permissions) a the WordPress installation
$ mysql -e "CREATE USER '${username}'@'localhost' IDENTIFIED BY '${password}';GRANT ALL PRIVILEGES ON *.* TO '${username}'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
try on your machine
explain this command
Now, finally, we come to the installation of the most popular blog system, which we download with the following command. In the best case, we should be in the "/var/www" directory when executing the command.
wordpress:download:latest Download the latest version of WordPress
$ wget https://wordpress.org/latest.zip
try on your machine
explain this command
Now that the ZIP file (latest.zip) is on the disk, we need to unpack it so that PHP can handle the files. Don't worry, we'll soon be at the end of the installation.
linux:zip:decompress Decompress the given zip file.
$ unzip ${filename}
try on your machine
Now you should still make sure that WordPress has the appropriate permissions in all the necessary directories so that images, plugins and themes can be uploaded.
wordpress:config:file-permissions Set the correct file permission
$ chmod -R 755 wp-content/
try on your machine
explain this command
The next step is a pro tip. We also always recommend using the official WordPress CLI when using WordPress. This can be installed very easily.
wordpress:cli:install Install the WordPress CLI tool.
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
$ chmod +x wp-cli.phar
$ sudo mv wp-cli.phar ${dir_to_install}
try on your machine
explain this command
Now we have done it and WordPress should be found under the appropriate domain or IP address.