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

  1. May 6, 2013 at 01:24

    Thanks for sharing, mate.
    One question:
    Can we activate friendly URL automatically?
    Thanks.

    • May 6, 2013 at 11:40

      With friendly URL I guess you mean pretty permalinks?

      When using nginx and pretty permalinks with wordpress you have to make some changes in your sites config file.
      What to update is best described in this post: http://nginxlibrary.com/wordpress-permalinks/

      Before reloading your configuration, read the first comment on that post. WordPress has changed since the original post and the correct format is listed in that comment.

      Hope it helps you to create a wonderful site!

  2. May 10, 2013 at 10:02

    Hi. Thats an excellent guide. I have recently used Tuxlite script and didnt go with minstall because of its not very clear documentation. But this guide is excellent. I have saved this for future reference. Can you please explain a bit about this command.

    cd /home/webber1/http/hosts/u00r.com
    su webber1

    Shouldnt we first create a /wordpress directory in u00r.com and then run the next wget http://wordpress.org/latest.tar.gz command.

    And secondly can you please explain a bit what this command does : mv ./wordpress/* ./ , Does it move the the wordpress to the root of u00r.com in this case or to the root of the user.

    I am sorry if my questions appear noob. I am not a Linux expert. Just learning.

    • May 10, 2013 at 20:39

      When you extract the files downloaded from the WordPress site, the wordpress directory is created.
      we then change user to webber1 with the command: su webber1

      The mv ./wordpress/* ./ command moves all files from the wordpress sub-directory into the root folder.

      You can skip this step if you want to have your blog in a sub-directory. I find it easier to have it in the root directory.

      I find your question legitimate, the guide could have explained it better.

  3. Saku
    August 11, 2013 at 04:18

    I’m having an issue with “bash minstall.sh http-install-mysql” and it said ” mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.” What could be the issue ? this is on Debian 7

    • Saku
      August 13, 2013 at 05:17

      Tried again on Debian 6 and it works fine 🙂

    • October 8, 2013 at 15:24

      Minstall is not compatible with Debian 7 yet. 🙁

  4. baidhowi
    October 3, 2013 at 23:38

    hi i wan ask
    how to add subdomain?
    example blog.domain.com
    where i must extract my old wordpress file?

    FYI i succes create subdomain, blog.domain.com i try to open n its works but my old wp not running

    thanks
    sorry my stupid english

    • October 8, 2013 at 15:38

      In the section “Adding a Virtual Host” enter your sub-domain instead of the domain name.
      That’s pretty much it. You do however need to update your DNS to point to your new sub-domain.

      Feel free to ask any questions, I’ll try to answer them all.

      • baidhowi
        November 24, 2013 at 20:24

        thanks bro

        one more question
        how to direct domain.com to http://www.domain.com
        where to replace .htaccess
        thank alot

        • November 28, 2013 at 23:57

          Sorry for the late reply, you will probably have found the solution.
          You should edit your nginx conf file for your site. The conf files for your sites are located in /etc/nginx/hosts.d/ and are named according to the sitename you set when creating the website with MINSTALL.

          in the server section add something like this :
          server {
          server_name domain.com;
          return 301 $scheme://www.domain.com$request_uri;
          }

          You need to have a config file for your http://www.domain.com also, this can be the same conf file that you are editing.
          just change the server_name parameter to :
          server_name www.domain.com domain.com
          and it will reply to either one. If you also add this part return 301 $scheme://www.domain.com$request_uri; you will always redirect to http://www.domain.com and serve your pages.

          HOpe this reply helps you out somewhat.

  5. baidhowi
    November 24, 2013 at 20:34

    one more, i want install phpmyadmin
    but file one /etc/nginx/sites-available/default not exists,
    where I can add syntax like this tutorial
    hxxp://www.debian-tutorials.com/how-to-run-phpmyadmin-on-nginx#more-2872

    thanks 😀

    • November 28, 2013 at 23:58

      all sites config files are here: /etc/nginx/hosts.d/

  6. Safwan Ahmad
    February 2, 2014 at 22:02

    After installing this i am unable to use openVPN using this tutorial:
    http://yaui.me/how-to-set-up-openvpn-in-30-seconds-or-less/

    Any help?

    • Safwan Ahmad
      February 2, 2014 at 22:08

      Oh! sorry please delete the above and this, i had to reenable TUN/TAP from solus to get it working,

      • February 3, 2014 at 18:54

        Sometimes Solus acts up and even if you click enable it isn’t enabled.

  7. Safwan Ahmad
    February 4, 2014 at 20:46

    After few hours of trial and error i was able to get moodle 2.6 working on this script using only one hack:

    https://moodle.org/mod/forum/discuss.php?d=234656

  8. tripleflix
    August 11, 2014 at 10:31

    i get an error using this, when trying to install on a LES box,

    # bash minstall.sh http-configure-mysql
    >> HTTP Configure: MySQL Database Server <<
    This module requires the mysql-server package to be installed, please install it using the http-install-mysql module and try again!
    root@nl2:~/minstall#

    even thou i just ran the script to install MySQL, thou it did not ask to set up a sql password…

    this is on a fresh server.

    • August 14, 2014 at 20:58

      Did you get the latest version of minstall?
      I never got that working properly on debian 7. Never tried it on on debian 7.5, guess it would feturn the same result.

      Max also said that he has very little time to develop the script even more, which is sad because I really liked it.

      I’ve been trying tuxlite ( http://www.tuxlite.com ) lately and used it to build the LowendSpirit wiki. ( wiki.lowendguide.com ).

      Will write a few words about tuxlite in a later guide.

Leave a Reply

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