Are you interested in turning your Linux operating system based machine into a web server? This is a detailed tutorial on how to build a Linux, Apache, MyStructured Query Language, and HyPertext Preprocessor server also known as linux apache myStructured Query Language Hypertext Preprocessor. These instructions are for Ubuntu version 12.04 operating system.
Obviously, if you are running Ubuntu you already have the Linux part taken care of. You will need a desktop or laptop computer running Ubuntu 12.04. You could probably use an old single core Pentium 4 machine with 512 Megabytes of random access memory at a minimum.
First, you want to test some security settings. Ubuntu 12.04 does not allow root logins by default and you must either sudo or sudo su in order to obtain root access. You will need root privileges for some of these steps.
Also, you may want to install secure shell, so that you may access your Linux web server remotely with a command line. For this tutorial you can either type :~$ sudo or :~$ sudo su to elevate to root.
Also for this tutorial you can feel free to copy and paste any commands in bold. At a command prompt you will want to type:
apt-get install openssh-server
Once successfully installed there is no configuration needed. You will need to open up a terminal application similar to Putty and then connect to your web server using port 22. You will want to login with your username and password.
Next, you will install Apache web server software. You can type this following command:
apt-get update
apt-get install apache2
This will check for Ubuntu Linux version 12.04 repository updates before you install Apache and then install Apache after these results. You will want to test Apache by opening up your internet protocol address in a web browser like this example:
https://192.168.1.1
You will see a page that says:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
If you do not know your web server internet protocal address, you can type this command in order to obtain it:
ifconfig eth0 | grep inet | awk ‘{ print $2 }’
Next, you will want to install MyStructured Query Language database software. You will need to type in this entire command:
apt-get install myStructured Query Language-server libapache2-mod-auth-myStructured Query Language Hypertext Preprocessor5-myStructured Query Language
My Structured Query Language will prompt you to set a root password. Now you will want to activate My Structured Query Language by typing this command:
mysql_install_db
Once My Structured Query Language is activated you will want to run an installation script with this command:
/usr/bin/mysql_secure_installation
You will be prompted to enter your My Structured Query Language root password. You will be prompted to change your My Structured Query Language root password, you can enter N for no. My Structured Query Language installation will ask you four final questions, which you can enter Y for all of them.
By default, a My Structured Query Language installation has an anonymous user, allowing anyone
to log into My Structured Query Language without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y
… Success!Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y
… Success!By default, My Structured Query Language comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y
… Success!Cleaning up…
Now that My Structured Query Language is successfully installed, you can then install Hypertext Preprocessor. Hypertext Preprocessor is a scripting language that WordPress uses. You will want to type this command in order to install Hypertext Preprocessor:
apt-get install php5 libapache2-mod-php5 php5-mcrypt
This Hypertext Preprocessor installation might prompt you twice. If so, you can enter Y each time. In order to serve appropriate Hypertext Preprocessor files you will want to add index.php to a directory configuration file.
You will want to open /etc/apache2/mods-enabled/dir.conf with a text editor for example Nano or vi. You want to add index.php to this directory index:
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
You can then save and close that file with your text editor. By default Hypertext Preprocessor has many modules available but not installed. You can type this command, in order to list any modules available.
apt-cache search php5-
In order to install a module you will want to type apt-get install “module name” like this example:
apt-get install php5-cgi
You can install multiple modules at once by adding them to that command seperated by a space in between them. Now that you have successfully installed Hypertext Preprocessor, it is recommended you create a Hypertext Preprocessor info file on your web server. This allows you to see detailed information about your web server.
You can open the following file with your text editor of choice.
/var/www/info.php
You will want to insert the following Hypertext Preprocessor info code into this info.php file.
You can then save and close that file. You will need to restart Apache web server with this command:
service apache2 restart
You can then browse to this file in a web browser like so:
https://192.168.1.1/info.php
You will see a Hypertext Preprocessor page with your web server system information. Finally, you can install WordPress now. You will want to document what directory you are located in on your command line.
You can download the latest version of WordPress with this following command:
wget https://wordpress.org/latest.tar.gz
You will want to decompress that file with this command:
tar -xzvf latest.tar.gz
This will decompress that tar file creating a wordpress folder in your current directory. You will need to create your My Structured Query Language database and user now. You can log into My Structured Query Language with this command:
mysql -u root -p
Then you will want to enter in your My Structured Query Language root password. Now you can create a My Structured Query Language database with this command:
CREATE DATABASE wordpress;
You will want to create a user for this database with this following command:
CREATE USER wordpressuser@localhost;
You will need to set a password for this created user with this command:
SET PASSWORD FOR wordpressuser@localhost= PASSWORD(“password”);
Now you are going to grant all permissions to this user with this following command:
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password’;
You can refresh My Structured Query Language now:
FLUSH PRIVILEGES;
You will want to exit out of a My Structured Query Language shell by typing:
exit
You will need to finish with the rest of this WordPress installation. You can copy this sample WordPress file to a different location by using this command:
cp wordpress/wp-config-sample.php wordpress/wp-config.php
Now you will want to open this configuration file with your text editor of choice:
wordpress/wp-config.php
In this file you will be changing DB_NAME, DB_USER, and DB_PASSWORD. The following is an example of what it should look like using your prior settings:
// ** My Structured Query Language settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress‘);
/** My Structured Query Language database username */
define(‘DB_USER’, ‘wordpressuser‘);
/** My Structured Query Language database password */
define(‘DB_PASSWORD’, ‘password‘);
Save and close that file. Now you are going to move those files and folders in a wordpress folder that you decompressed earlier:
rsync -avP wordpress/ var/www/
You are almost finished with a Wordpress installation, but need to set some permissions. You will want to change that directory to the web root folder:
cd /var/www/
You will want to give ownership now of this directory of Apache web server to:
chown www-data:www-data /var/www -R
chmod g+w /var/www -R
You will need to install a module for WordPress with this command:
apt-get install php5-gd
You can then access your WordPress online installation by browsing to:
https://192.168.1.1/wp-admin/install.php
You will see a drop down list of languages to choose from. You can then click on Continue. Now you will see this page:
Welcome
Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.
You can change settings on this page later. You will want to type in a Site Title. Then you can type in a Username in order to log into WordPress.
You can set your WordPress username and password in both boxes in Password, twice. You will want to type in your email address in order to reset your password if you forget it later in Your E-mail. In a Privacy box.
You will want to click on Install WordPress. After a few moments you should see a success page with this:
Success!
WordPress has been installed. Were you expecting more steps? Sorry to disappoint.
Username username
Password Your chosen password.
You will want to click on a Log In button in order to log into your newly created WordPress website on your Linux web server. These instructions were written for Ubuntu Linux operating system version 12.04. You may be able to use them as a basis point for other Linux operating system distributions.