Installing WordPress using MINSTALL

In this guide we will go through howto install a basic wordpress site using Minstall to minimize the memory footprint by removing unnecessary services.

I will be using a a OpenVZ vps with 256 mb RAM to show you the steps needed.

Lets start fresh with a reinstall from your provider’s control panel. In this case I choose a 32-bit debian minimal installation.

When the reinstall is ready, log into your vps and as root download Minstall from Github by running this:

Now it’s time to update the sources file, remove all packages that are not needed and install nginx/php/mysql.
Not to forget, since we are cleaning up the installed packages, we will end up without a SSH Daemon so that will also be installed.

There is a post about an Introduction to Minstall, read that if you are interested to know more about what you can do with this script. I will only use the necessary commands here to reach our goal.

Time to clean up the vps some more:

This will take some time and when it’s done you will see this warning:

Ok, No SSH Server is installed, lets install Dropbear since it uses less memory then the more common OpenSSHD:

Answer (Y)es on all question asked and when the installation is done, connect to your server with another session, just to make sure that you haven’t locked yourself out.

Lets add some extra repositories so we can run the latest PHP version among other things.

Same thing here again, answer (Y)es on all questions.

Lets add some extra packages which will allow us to use some usefull commands later on.

I think you all know it by know :), answer (Y) on all question asked.

Some general configuration

This time you will need to read (and hopefully understand) all questions asked. Taking that the default option (N)0 on some questions.

Accept the proposed value and set your timezone. Since I’m Swedish, I chose Europe/Stocholm as my time zone.

timezone geographic-area

Why would we  set the time zone to our local time zone instead of the time zone where the server is located? Since I have servers all over the world, in my mind it is easier to read logs with my local time in them instead of remembering in what time zone this server is and how is that different from where I am now.

Moving on!

Installing the NginX, MySQL, PHP and Exim

We will install the foundation by running these commands (Using the suggested answer to all presented questions):

When it comes to the last command in the code box above (installing mySQL) you will be promted to set a mySQL root password. Make sure you use a secure password.

 INFO: I use Keepass to generate new passwords wherever it’s needed

We need to configure both mySQL and nginX before we are done and as usual, accept the proposed answer to all asked  questions.

Now that we are done with the foundation we are ready to create the first (of many?) wordpress sites on this server.

Adding a user

Every domain or Virtual Host that we want to add to this server needs to be run under a user account, so the first step is to create a user account.

In this guide I have decided to call my user: webber1.
add-user

When the user is created you will see that a http folder has been created in that users home directory. In that http folder is a hosts folder and this is where all your sites running under this user will be located.

http-folder

Adding a Virtual Host

Now that we got that sorted, lets add the Virtual Host or domain name that we will be using.

The first question you will be asked for when running the above command is: Please enter a user name.

Remember the name of the user we created above? Enter that users name and press Enter.

Next question is, Please enter the virtual host (e.g. www.example.com) 

the domain name I use in this example will be u00r.com, so I type that in and press Enter.

Do you want to enable PHP for this virtual host? (Y/n)
We will be running WordPress, so the answer is (Y)es.

Do you want to enable SSL for this virtual host? (Y/n)
Why not, the answer will be (Y)es.

Do you want to set this virtual host as the default host? (y/N)
No, if we decide to add more sites on this server and someone enters the IP of the server, this would be showing. Lets stick with the default nginX page instead. The answer is therefor (N)o.

add-host

At this point we can update the domain name on the DNS servers pointing it to this server and we would have a working site. It would not run WordPress at this moment but we will add that in a minute.

Adding a mySQL user and database

As you probably already know, WordPress needs a database to run and we need to create it.

We will do this using mysql-cli, enter this and press Enter. You will be promted for your root mySQL password. Do you remember it from when we installed the mySQL Server above?

1_mysql-cli

To create the database we need to think of a name for the database, I have decided to call mine webber1_wpdb.

Next step is to create a mySQL user that will be used to access this database.
If you read my previous post about initial wordpress security you will know why I don’t create the user with ALL privileges to the database.

Almost done, all we need to do is to flush the privileges to make sure they are updated.

Now exit the mysql-cli and install WordPress.

Installing WordPress

Step one is to change to the Virtual host directory and then su into our newly created user.

Now its time to download the latest version of wordpress and unpack it.

Now open your favourite web browser and enter your domain name in the address field and press enter. Viola! You should now see the first step in configuring your WordPress site.

Step-one-wordpress

If you don’t see it, did you remember to update the DNS Server entry for your domain?
Any other errors, post your questions in the comment section and I will try to answer them.

Follow the simple steps presented to you, the important part is to enter the database connection details as we created them earlier.

Step-two-wordpressStep-three-wordpress
Look at the screenshot over the connection details and notice that I changed the default table prefix. That is also a recommendation from this post.

Step-four-wordpress

You should also use some other username then the default admin. Chose something that is easy for you to remember but noone else would be able to guess.
Also remember to use a strong password for this account.
Finish the wizard and we have only one thing left before we can enjoy our newly installed WordPress and that is to change the Authentication Unique Keys and Salts.

To do that we need to go back to our terminal window and as our Virtual Host user (in my case webber1) edit the wp-config.php file.

Find the section about Authentication Unique Keys and Salts and then copy the URL that you find there into your web browser.
This will create random unique phrases for you to use on your installation.
Copy the result from the webpage into your wp-config.php file, OVERWRITING or DELETING the default values.

 

Tip: You can use CTRL+K to delete a row in nano.

 

Save and Close with CTRL+X and we are all done!

Log into your wordpress installation and configure it with the templates and plugins you like. Fill it with content that you feel important and last but not least, enjoy being a blogger.

 

Final words

There we have it, a working WordPress site using Minstall to create the foundation.

If you want to add more sites to this server, perhaps even more WordPress sites, you need to decide if you want to run the new site under the same user as your previous site or not (I recommend that you create a new user for each site).

After that decision is made, all you have to do is to go back in this guide and read the following headings:

  • Adding a user
  • Adding a Virtual Host
  • Adding a mySQL user and database
  • Installing WordPress

remember to only use a user/password or database name once. Always use different SECURE passwords.

 

21 comments for “Installing WordPress using MINSTALL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.