Now to "sexy" this post up! I give you...the hardware!
2 gigs of gskill ram (soon 4 gigs)
A 40gig Intel SSD for the OS and apps
A 1TB drive for LOL Catz and Demotivational posters.
Total price for this little gem is $392.95 (or about $450 after shipping/handling). But the best part is the energy draw. According to a Tom's Hardware review the D510 should pull about 33-40 watts at full load. A far cry from the 400+ watts my old server use to draw at load!
Hardware is setup and ready to rock....it is CentOS time!
First we must get ourselves an *.iso image of CentOS to use in either a bootable USB stick (instructions on that here) or a bootable CD/DVD. If windows 7 is your primary os you can burn the iso disk using windows. If you are on XP you will need burner software capable of making an iso disk. I would suggest XP Burner. Here a mirror for you! From that link choose which hardware architecture you are on, in my case the x86_64 bit. Next find the appropriate install. When I installed it I went with the Live DVD you can find that here. So once your iso of choice has been burned / turned into a bootable USB drive it is time to start the install. Now I am not big on going through step by step the install process of many Linux distros because frankly a lot of time and effort has gone into making them dead simple. Like my mom has installed Ubuntu. If she can do that you can do CentOS. So assuming you are installing this on the hardware above you may be staring a blue screen and thinking WTF?!?! If you are on different hardware skip down to the LAMP server setup section.
STOP HAMMER TIME.
Ok at this point, just after the install has finished I hit a wall, I could do nothing....no mouse, no icons just a blue screen taunting me. I think, maybe I just need to reboot. NOPE. Reinstall....NOPE. Chuck Testa....NOPE. Nothing worked. At some point in my obscenity laced tirade I bumped my mouse hard. Well hello little cursor! Where have you been hiding!? With the mere power of right click I was able to open up a terminal window and type "gnome-display-settings" and up pops the desktop settings. Problem found. It was showing not one but two monitors. One disabled and the other something obscene like 3072 x 2048. Well I disabled the other monitor and set the current display to the correct resolution and we were in like Flint. Crisis resolved. The same procedure (flail the mouse about until it appears on screen and set the correct resolution) had to be repeated for each user, but once that was done it was all good. On to setting up the LAMP server!
LAMP - Linux Apache MySQL PHP
I make no claim to this section of the setup process. I used the guide below and it helped me greatly, I got all this stuff from here...
http://library.linode.com/lamp-guides/centos-6 by Sam Kleinman Please show them love and go to the site if this works for you.
--------------------------------------------START RIP OFF-----------------------------------------------
------------------------ END RIP OFF-----------------------------------------------------------
STOP HAMMER TIME.
Ok at this point, just after the install has finished I hit a wall, I could do nothing....no mouse, no icons just a blue screen taunting me. I think, maybe I just need to reboot. NOPE. Reinstall....NOPE. Chuck Testa....NOPE. Nothing worked. At some point in my obscenity laced tirade I bumped my mouse hard. Well hello little cursor! Where have you been hiding!? With the mere power of right click I was able to open up a terminal window and type "gnome-display-settings" and up pops the desktop settings. Problem found. It was showing not one but two monitors. One disabled and the other something obscene like 3072 x 2048. Well I disabled the other monitor and set the current display to the correct resolution and we were in like Flint. Crisis resolved. The same procedure (flail the mouse about until it appears on screen and set the correct resolution) had to be repeated for each user, but once that was done it was all good. On to setting up the LAMP server!
LAMP - Linux Apache MySQL PHP
I make no claim to this section of the setup process. I used the guide below and it helped me greatly, I got all this stuff from here...
http://library.linode.com/lamp-guides/centos-6 by Sam Kleinman Please show them love and go to the site if this works for you.
--------------------------------------------START RIP OFF-----------------------------------------------
This guide provides step-by-step instructions for installing a full-featured LAMP stack on a CentOS 6 system.
In this guide, you will be instructed on setting up Apache, MySQL, and PHP. If you don't feel that you will need MySQL or PHP, please don't feel obligated to install theM.
Before you begin installing and configuring the components described in this guide, please make sure you've followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:
hostname hostname -f
The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).
Install and Configure the Apache Web Server
The Apache Web Server is a very popular choice for serving web pages. While many alternatives have appeared in the last few years, Apache remains a powerful option that we recommend for most uses.
To install the current version of the Apache web server (in the 2.x series) use the following command:
yum update yum install httpd
The configuration for Apache is contained in the httpd.conf file, which is located at: /etc/httpd/conf/httpd.conf. We advise you to make a backup of this file into your home directory, like so:
cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup
By default all files ending in the .conf extension in /etc/httpd/conf.d/ are treated as Apache configuration files, and we recommend placing your non-standard configuration options in files in these directories. Regardless how you choose to organize your configuration files, making regular backups of known working states is highly recommended.
Now we'll configure virtual hosting so that we can host multiple domains (or subdomains) with the server. These websites can be controlled by different users, or by a single user, as you prefer.
Before we get started, we suggest that you combine all configuration on virtual hosting into a single file called vhost.conf located in the /etc/httpd/conf.d/ directory. Open this file in your favorite text editor, and we'll begin by setting up virtual hosting.
Configure Name-based Virtual Hosts
There are different ways to set up Virtual Hosts, however we recommend the method below. By default, Apache listens on all IP addresses available to it.
Now we will create virtual host entries for each site that we need to host with this server. Here are two examples for sites at "example.com" and "example.org".
File excerpt:/etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example.com/public_html/
ErrorLog /srv/www/example.com/logs/error.log
CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@example.org
ServerName example.org
ServerAlias www.example.org
DocumentRoot /srv/www/example.org/public_html/
ErrorLog /srv/www/example.org/logs/error.log
CustomLog /srv/www/example.org/logs/access.log combined
</VirtualHost>
Notes regarding this example configuration:
- All of the files for the sites that you host will be located in directories that exist underneath /srv/www You can symbolically link these directories into other locations if you need them to exist in other places.
- ErrorLog and CustomLog entries are suggested for more fine-grained logging, but are not required. If they are defined (as shown above), the logs directories must be created before you restart Apache.
Before you can use the above configuration you'll need to create the specified directories. For the above configuration, you can do this with the following commands:
mkdir -p /srv/www/example.com/public_html mkdir /srv/www/example.com/logs mkdir -p /srv/www/example.org/public_html mkdir /srv/www/example.org/logs
After you've set up your virtual hosts, issue the following command to run Apache for the first time:
/etc/init.d/httpd start
Assuming that you have configured the DNS for your domain to point to your Linode's IP address, Virtual hosting for your domain should now work. Remember that you can create as many virtual hosts with Apache as you need.
If you want to run Apache by default when the system boots, which is a typical setup, execute the following command:
/sbin/chkconfig --levels 235 httpd on
Use the chkconfig command to setup runlevels as needed.
Anytime you change an option in your vhost.conf file, or any other Apache configuration remember to reload the configuration with the following command:
/etc/init.d/httpd reload
Install and Configure MySQL Database Server
MySQL is a relational database management system (RDBMS) and is a popular component in contemporary web development tool-chains. It is used to store data for many popular applications, including Wordpress and Drupal.
Install MySQL
The first step is to install the mysql-server package, which is accomplished by the following command:
yum install mysql-server
In CentOS 6 this provides version 5.1.52 of MySQL. Before you can use MySQL some configuration is required.
If you want to run MySQL by default when the system boots, which is a typical setup, execute the following command:
/sbin/chkconfig --levels 235 mysqld on
Now you can start the mysql daemon (mysqld) with the following command (as root):
/etc/init.d/mysqld start
At this point MySQL should be ready to configure and run. While you shouldn't need to change the configuration file, note that it is located at /etc/my.cnf for future reference.
Configure MySQL and Set Up MySQL databases
After installing MySQL, it's recommended that you run mysql_secure_installation, a program that helps secure MySQL. While running mysql_secure_installation, you will be presented with the opportunity to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options. If you are prompted to reload the privilege tables, select yes. Run the following command to execute the program:
mysql_secure_installation
Next, we'll create a database and grant your users permissions to use databases. First, log in to MySQL:
mysql -u root -p
Enter MySQL's root password, and you'll be presented with a prompt where you can issue SQL statements to interact with the database.
To create a database and grant your users permissions on it, issue the following command. Note, the semi-colons (;) at the end of the lines are crucial for ending the commands. Your command should look like this:
create database lollipop; grant all on lollipop.* to 'foreman' identified by '5t1ck';
In the example above, lollipop is the name of the database, foreman is the username, and 5t1ck password. Note that database user names and passwords are only used by scripts connecting to the database, and that database user account names need not (and perhaps should not) represent actual user accounts on the system.
With that completed you've successfully configured MySQL and you may now pass these database credentials on to your users. To exit the MySQL database administration utility issue the following command:
quit
With Apache and MySQL installed you are now ready to move on to installing PHP to provide scripting support for your web pages.
Installing and Configuring PHP
PHP makes it possible to produce dynamic and interactive pages using your own scripts and popular web development frameworks. Furthermore, many popular web applications like WordPress are written in PHP. If you want to be able to develop your websites using PHP, you must first install it.
CentOS includes packages for installing PHP from the terminal. Issue the following command:
yum install php php-pear
Once PHP5 is installed we'll need to tune the configuration file located in /etc/php.ini to enable more descriptive errors, logging, and better performance. These modifications provide a good starting point if you're unfamiliar with PHP configuration.
Make sure that the following values are set, and relevant lines are uncommented (comments are lines beginning with a semi-colon (;)):
File excerpt:/etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log
max_execution_time = 300
memory_limit = 64M
register_globals = Off
If you need support for MySQL in PHP, then you must install the php5-mysql package with the following command:
yum install php-mysql
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
------------------------ END RIP OFF-----------------------------------------------------------
You should how have a good jumping off point for numerous projects! Next article I will discuss how to setup the OTRS open source help desk ticketing software on your new server! :D
No comments:
Post a Comment