<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ray Heffer &#187; perl</title>
	<atom:link href="http://www.rayheffer.com/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rayheffer.com</link>
	<description>Enterprise Technologies</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Building a secure web server with CentOS 5, part 1</title>
		<link>http://www.rayheffer.com/36/building-a-secure-web-server-with-centos-5-part-1/</link>
		<comments>http://www.rayheffer.com/36/building-a-secure-web-server-with-centos-5-part-1/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:20:49 +0000</pubDate>
		<dc:creator>Ray Heffer</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://wp.rayheffer.com/?p=36</guid>
		<description><![CDATA[Part 1 &#124; Part 2 &#124; Part 3 &#124; Troubleshooting Introduction This is an updated version of my original LAMP (Linux Apache MySQL and Perl/PHP) guide that was based on CentOS 4. Now updated and tweaked for CentOS 5, I will take you through the steps required to build a secure Linux web server (LAMP) [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rayheffer.com%2F36%2Fbuilding-a-secure-web-server-with-centos-5-part-1%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.rayheffer.com_2F36_2Fbuilding-a-secure-web-server-with-centos-5-part-1_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rayheffer.com%2F36%2Fbuilding-a-secure-web-server-with-centos-5-part-1%2F&amp;source=rayheffer&amp;style=normal&amp;service=TinyURL.com&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Part 1</strong> | <a href="http://www.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/">Part 2</a> | <a href="http://www.rayheffer.com/106/building-a-secure-web-server-with-centos-5-part-3/">Part 3</a> | <a href="http://www.rayheffer.com/117/troubleshooting-your-centos-5-web-server/">Troubleshooting</a></p>
<p><strong>Introduction</strong><br />
This is an updated version of my original LAMP (Linux Apache MySQL and Perl/PHP) guide that was based on CentOS 4. Now updated and tweaked for CentOS 5, I will take you through the steps required to build a secure Linux web server (LAMP) on CentOS 5.</p>
<p>I have a background working for an ISP, so I’ve based this build on the same configuration many hosting providers use. It supports virtual hosts (multiple websites), secure FTP access, locked down SSH access, and a sensible directory structure.</p>
<p>If you follow this guide, you will get a web server up and running within a couple of hours depending on whether you follow it step by step, or prefer to experiment first. If you are new to Linux then give it a try and learn something new, you never know you may surprise yourself!</p>
<p>Good luck!<br />
<span id="more-36"></span><br />
<strong>A word on web hosting</strong></p>
<p>Before you get started with your server build, I&#8217;d like to talk about where you are going to host this server. There have been a number of developments in the past few years in regards to people hosting websites on their home ISP broadband connection.</p>
<p>Firstly, did you know that many of the major search engines will not crawl your website if it&#8217;s hosted on a residential IP address? What I mean by residential is an IP address provided by the likes of an ADSL or broadband provider (e.g. Virgin Media, BT, PlusNet, here in the UK). It will depend on the ISP whether you get a &#8216;fixed&#8217; IP address or not, and even if you do your site will simply be ignored by the major search engines as they will recognise the IP address in a residential (non ISP) range. Don&#8217;t get me wrong, running web servers at home is great fun but I would recommend you avoid it unless it is purely for testing.</p>
<p>So, where is the best place to host your shiny new CentOS web server?</p>
<p>I would highly recommend getting a VPS (Virtual Private Server). There are plenty of hosting companies offering Virtual Private Servers, and VPS hosting is getting cheaper.</p>
<p>I would personally recommend <a href="http://www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1" onclick="pageTracker._trackPageview('/outgoing/www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1&amp;referer=');">Linode</a>, I have been using them since 2006 and recently they have started hosting virtual servers in the London, UK as well as the USA. They provide a generous amount of bandwidth, starting at around 200GiB per month with 16GB+ of disk space depending on which option you go for. You can choose from a massive list of Linux distro&#8217;s, including CentOS 5! They use Xen virtualisation and they have an excellent web interface for accessing your server stats, server controls, DNS, and console access.</p>
<p><strong>Getting Started</strong></p>
<p>CentOS 5 is completely free and developed by a team of core developers at a North American Enterprise Linux vendor. In turn the core developers are supported by an active user community including system administrators, network administrators, enterprise users, managers, core Linux contributors and Linux enthusiasts from around the world.</p>
<p>CentOS has numerous advantages over some of the other clone projects including: an active and growing user community, quickly rebuilt, tested, and QA&#8217;ed errata packages, an extensive mirror network, developers who are contactable and responsive, multiple free support avenues including IRC Chat, Mailing Lists, Forums, a dynamic FAQ. Commercial support is offered via a number of vendors.</p>
<p>CentOS 5 is distributed on six CD&#8217;s, all of which are available for download from the <a href="http://www.centos.org" onclick="pageTracker._trackPageview('/outgoing/www.centos.org?referer=');">CentOS </a>website.</p>
<p><strong>Download phpMyAdmin</strong></p>
<p>This is optional, but I would highly recommend this excellent web interface for administering your MySQL databases. I have used this in the past to provide customers with their own phpMyAdmin login username, so they can manage their databases easily.</p>
<p><a href="http://www.phpmyadmin.net" onclick="pageTracker._trackPageview('/outgoing/www.phpmyadmin.net?referer=');">http://www.phpmyadmin.net</a></p>
<p><strong>Installing CentOS</strong></p>
<p><strong>NOTE:</strong> If you are using a virtual private server (VPS) provided by a hosting company such as <a href="http://www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1" onclick="pageTracker._trackPageview('/outgoing/www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1&amp;referer=');">Linode</a>, and CentOS is already installed then skip ahead to the next section.</p>
<ul>
<li>Insert CD of the CentOS 5 installation CD and boot your server.</li>
<li>At the installation menu, just press ENTER for the graphical installation wizard.</li>
<li>When prompted for an installation type select custom installation and de-select all options for bare install.</li>
<li>Use automatic partitioning for the disks.</li>
<li>Remove all partitions from system (make sure you are happy to wipe all existing data!!).</li>
<li>Boot Loader: Leave default settings.</li>
<li>Network Configuration: Configure this with an internal IP address and DNS name.</li>
<li>Firewall: Select ‘No firewall’ as this will be installed and configured later.</li>
<li>SELinux: Set to ‘Disabled’. This is still very experimental so I would leave this switched off unless you really know what you are doing.</li>
<li>Authentication: Set a secure root password using random characters and numbers (upper an lower case).</li>
<li>Package Selection: Choose minimal configuration (Other packages can be installed at a later stage according to the server role).</li>
</ul>
<p>WARNING!! – The server should not be connected to the internet until the configuration is completed and secure!</p>
<p><strong>Updating the System</strong></p>
<p>Now that you have CentOS 5 installed, we need to make sure it&#8217;s up to date and then do some basic security configuration with SSH. Unlike CentOS 4, you no longer have to import the RPM key to update and install software. It does this for you.</p>
<p>To check for updates type the following:</p>
<p><code># yum check-update</code></p>
<p>Now perform the update process. Note, the -y is to accept all updates which I recommend as it&#8217;s a clean installation.</p>
<p><code># yum –y update</code></p>
<p><strong>Setting the clock</strong><br />
I strongly advise that you setup the timezone and clock correctly. First, you set /etc/localtime to link to the correct timezone, then either set the time manually or configure NTPD to syncronise with an internet time server such as pool.ntp.org.</p>
<p>Example of setting the timezone to GMT:</p>
<p><code># ln -sf /usr/share/zoneinfo/GMT /etc/localtime</code></p>
<p><strong>Setting the hardware clock:</strong></p>
<p><code># vi /etc/sysconfig/clock</code></p>
<p><strong>System Services Configuration</strong></p>
<p>As this is going to be a finely tuned web server, we don&#8217;t want uneccessary daemons running! Firstly, lets list all the daemons that have been configured to run at startup.</p>
<p><code># chkconfig –list|grep on</code></p>
<p>You should now get an output similar to the following:</p>
<p><code>anacron 0:off 1:off 2:off 3:off 4:off 5:off 6:off<br />
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off<br />
crond 0:off 1:on 2:off 3:on 4:on 5:on 6:off<br />
cups 0:off 1:on 2:off 3:on 4:on 5:on 6:off<br />
haldaemon 0:off 1:on 2:off 3:off 4:on 5:on 6:off<br />
messagebus0:off 1:on 2:off 3:off 4:on 5:on 6:off<br />
network 0:off 1:on 2:off 3:off 4:on 5:on 6:off<br />
syslog 0:off 1:on 2:off 3:off 4:on 5:on 6:off</code></p>
<p>Your list will probably be a lot longer as this is just an example, but what you can see here is the different run levels and their on/off status. Most daemons start at run level 3. Now lets switch off the daemons that aren&#8217;t needed. I&#8217;ve listed a few more here that you are likely to find.</p>
<p><code># chkconfig cups off<br />
# chkconfig apmd off<br />
# chkconfig netfs off<br />
# chkconfig pcmcia off<br />
# chkconfig smartd off<br />
# chkconfig anacron off<br />
# chkconfig mdmonitor off<br />
# chkconfig isdn off</code></p>
<p><strong>NOTE:</strong> If you are using <a href="http://www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1" onclick="pageTracker._trackPageview('/outgoing/www.linode.com/?r=6af02fe4285827f3bb09d52875f71dfa026d21f1&amp;referer=');">Linode</a> then you should also switch off Kudzu (hardware detection) as this serves no purpose on a virtual UML system.</p>
<p><strong>Host Access (TCP_WRAPPERS)</strong></p>
<p>There are two host access files (/etc/hosts.allow and /etc/hosts.deny), that are part of the TCP_WRAPPER package. This makes it possible to allow or deny access to certain services based on the IP.</p>
<p>Edit the hosts.allow and hosts.deny files:<br />
<code># vi /etc/hosts.allow</code></p>
<p><code>sshd:&lt;IP ADDRESS&gt;<br />
vsftpd:ALL<br />
sendmail:ALL</code></p>
<p><code># vi /etc/hosts.deny</code></p>
<p><code>ALL:ALL</code></p>
<p>The <code>&lt;IP ADDRESS&gt;</code> above is the internet IP you are connecting from (don&#8217;t include <code>&lt;</code> or <code>&gt;</code>). You can enter multiple IP address here (separated by spaces) or to allow SSH from any IP just replace with <code>ALL</code>.</p>
<p>The root account should never be able to login via SSH (without first logging in as a user). You must change this, so edit /etc/ssh/sshd_config and ensure the following is set:</p>
<p><code># vi /etc/ssh/sshd_config</code></p>
<p>Change the following lines as follows:</p>
<p><code>PermitRootLogin no<br />
Protocol 2</code></p>
<p><strong>Note: </strong>Some of these lines may already exist but will be commented out using #. To enable these commands the # needs to be removed.</p>
<p><strong>Add Default Accounts</strong></p>
<p>Before proceeding with any of the steps below, first create a user account that you will use to log in to this server. This account will be used for SSH connections.</p>
<p><code># adduser <em>&lt;username&gt;</em><br />
# passwd <em>&lt;username&gt;</em></code></p>
<p>You should now have access to the server via SSH. Download <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" onclick="pageTracker._trackPageview('/outgoing/www.chiark.greenend.org.uk/_sgtatham/putty/download.html?referer=');">PuTTY</a> and make sure it works.</p>
<p>When you are ready proceed to <a href="http://wp.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/" onclick="pageTracker._trackPageview('/outgoing/wp.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/?referer=');">part 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rayheffer.com/36/building-a-secure-web-server-with-centos-5-part-1/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Building a secure web server with CentOS 5, part 2</title>
		<link>http://www.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/</link>
		<comments>http://www.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 20:44:02 +0000</pubDate>
		<dc:creator>Ray Heffer</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[http.conf]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[vsftp]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://wp.rayheffer.com/?p=91</guid>
		<description><![CDATA[Part 1 &#124; Part 2 &#124; Part 3 &#124; Troubleshooting Part 2: Configuring the Server Configuring CentOS Edit /etc/hosts and /etc/sysconfig/network with hostnames Install Packages Example of /etc/hosts: # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost 67.34.32.11 www.mydomain.com Example of /etc/sysconfig/network NETWORKING=yes HOSTNAME=www.mydomain.com Installing Packages # yum [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.rayheffer.com%2F91%2Fbuilding-a-secure-web-server-with-centos-5-part-2%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fwww.rayheffer.com_2F91_2Fbuilding-a-secure-web-server-with-centos-5-part-2_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.rayheffer.com%2F91%2Fbuilding-a-secure-web-server-with-centos-5-part-2%2F&amp;source=rayheffer&amp;style=normal&amp;service=TinyURL.com&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.rayheffer.com/36/building-a-secure-web-server-with-centos-5-part-1/">Part 1</a> | <strong>Part 2</strong> | <a href="http://www.rayheffer.com/106/building-a-secure-web-server-with-centos-5-part-3/">Part 3</a> | <a href="http://www.rayheffer.com/117/troubleshooting-your-centos-5-web-server/">Troubleshooting</a></p>
<p><strong>Part 2: Configuring the Server</strong></p>
<p><strong>Configuring CentOS</strong></p>
<ul>
<li>Edit <code>/etc/hosts</code> and <code>/etc/sysconfig/network</code> with hostnames</li>
<li>Install Packages</li>
</ul>
<p><strong>Example of /etc/hosts:</strong></p>
<p><code># Do not remove the following line, or various programs<br />
# that require network functionality will fail.<br />
127.0.0.1 localhost<br />
67.34.32.11 www.mydomain.com</code></p>
<p><strong>Example of /etc/sysconfig/network</strong></p>
<p><code>NETWORKING=yes<br />
HOSTNAME=www.mydomain.com</code></p>
<p><strong>Installing Packages</strong></p>
<p><code># yum -y install httpd openssl-devel openssl mod_ssl vsftpd rpm-build rpm-devel autoconf automake lynx gcc<br />
# yum -y install mysql mod_auth_mysql mysql-devel mysql-server<br />
# yum -y install mod_python python python-devel<br />
# yum -y install perl mod_perl mod_perl-devel openssl-perl perl-Convert-ASN1 perl-Date-Calc perl-DateManip perl-HTML-Parser perl-libwww-perl perl-CPAN perl-DBD-MySQL perl-XML-Parser<br />
# yum -y install php-devel php php-domxml php-gd php-mbstring php-mysql php-ncurses php-pear<br />
# yum -y install webalizer<br />
# yum -y install sendmail sendmail-cf</code><br />
<span id="more-91"></span><br />
<strong>Creating Directory Structure</strong></p>
<p>All websites will be held in <code>/home/.sites/</code>. The first site that needs to be created is the <code>_default</code> site, which will be used as this servers default website.</p>
<p><code># mkdir /home/.sites<br />
# cd /home/.sites<br />
# mkdir _default<br />
# cd _default<br />
# mkdir logs private cgi-bin web<br />
# cd web<br />
# mkdir stats</code></p>
<p>Now change the ownership of these directories to adminftp as follows:</p>
<p><code># cd /home/.sites<br />
# chown adminftp _default -R</code></p>
<p>Configure the required system services sto start at boot:</p>
<p><code># chkconfig httpd on<br />
# chkconfig mysqld on<br />
# chkconfig vsftpd on<br />
# chkconfig sshd on</code></p>
<p><strong>Configuring Apache</strong></p>
<p>Apache runs as the httpd service, and it’s configuration file is contained in <code>/etc/httpd/conf</code>. To run in a ‘virtual’ hosting environment, we will now configure the httpd.conf file. But first things first, lets backup the httpd.conf file!</p>
<p><code># cd /etc/httpd/conf<br />
# cp httpd.conf httpd.conf.backup</code></p>
<p>Now edit httpd.conf (<code>vi /etc/httpd/conf/httpd.conf</code>) and make the following changes (substituting <code>mydomain.com</code> for your own domain).</p>
<p>The first section should be inside the httpd.conf file by default, so you just need to search for each line. You can easily do this using Vi by typing a forward slash then the keyword followed by enter (E.g. /ServerAdmin) and this will skip to that section if it is found. A bit like using Find in Windows.</p>
<p><code>ServerAdmin admin@mydomain.com<br />
ServerName www.mydomain.com:80<br />
NameVirtualHost *:80<br />
DirectoryIndex index.html index.htm index.html.var</code></p>
<p>Next, skip to the very bottom of the httpd.conf file and you should see something similar to this:</p>
<p><code>&lt;VirtualHost *:80&gt;<br />
ServerAdmin webmaster@dummy-host.example.com<br />
DocumentRoot /www/docs/dummy-host.example.com<br />
ServerName dummy-host.example.com<br />
ErrorLog logs/dummy-host.example.com-error_log<br />
CustomLog logs/dummy-host.example.com-access_log common<br />
&lt;/VirtualHost&gt;</code></p>
<p>Make sure that this section isn&#8217;t commented out (with #) on each line, and then change the ServerAdmin, DocumentRoot, ServerName, ErrorLog and CustomLog . See the following example:</p>
<p><code>&lt;VirtualHost *:80&gt;<br />
ServerAdmin admin@mydomain.com<br />
DocumentRoot /home/.sites/_default/web<br />
ServerName www.mydomain.com<br />
ScriptAlias /cgi-bin/ /home/.sites/_default/cgi-bin/<br />
ErrorLog /home/.sites/_default/logs/error_log<br />
TransferLog /home/.sites/_default/logs/access_log</code></p>
<p><code>Options FollowSymLinks<br />
Options +Includes<br />
AllowOverride All<br />
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;">&lt;/VirtualHost&gt;</span></code></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;">You can host multiple websites by adding further VirtualHost sections, and each website is identified using the <code>ServerName</code> line. If your website has multiple domain names (E.g. www.mydomain.com www.mydomain.net mydomain.biz) then just add each one on a new line after <code>ServerName </code>with <code>ServerAlias</code>.</span></p>
<p>Save and exit the httpd.conf file and then restart the httpd service.</p>
<p><code># /etc/init.d/httpd restart</code></p>
<p><strong>Configuring VSFTP</strong></p>
<p>VSFTP stands for Very Secure File Transfer Protocol. However using the installation defaults isn&#8217;t actually that secure as it allows anonymous access and doesn&#8217;t restrict which users can access the servers FTP service. In order to harden the security of VSFTP, several configuration changes must be made. Please note that some of these lines may be commented out by default, with a #, so remember to remove this if required.</p>
<p><code># vi /etc/vsftpd/vsftpd.conf</code></p>
<p><code>anonymous_enable=NO<br />
xferlog_file=/var/log/vsftpd.log<br />
idle_session_timeout=600<br />
nopriv_user=nobody<br />
ascii_upload_enable=YES<br />
ftpd_banner= **** WARNING - Your actions are being logged ****</code></p>
<p><code>pam_service_name=vsftpd<br />
userlist_enable=YES<br />
listen=YES<br />
tcp_wrappers=YES<br />
chroot_local_user=YES<br />
userlist_deny=NO</code></p>
<p>Next, we need to configure <code>vsftpd.userlist</code> and specify which users can FTP to the server. This compliments the <code>userlist_deny</code> setting in vsftpd.conf. When set to <code>NO</code>, this makes the <code>vsftpd.userlist</code> file a list of users that ARE allowed to log in.</p>
<p><code># vi /etc/vsftpd/user_list</code></p>
<p>Remove all of the users that are listed in this file by default, and add ONLY the users that require access to the FTP server.</p>
<p><strong>Configuring MySQL</strong></p>
<p>MySQL is configured using /etc/my.cnf, but prior to any configuration this configuration file has only the bare minimum required to start the MySQL daemon. However there are 5 templates that we can base the configuration on; <code>my-huge.cnf</code>, <code>my-innodb-heavy-4G.cnf</code>, <code>my-large.cnf</code>, <code>my-medium.cnf</code>, and <code>my-small.cnf</code>. These are each configured depending on the RAM and the priority that MySQL has on this server.</p>
<p>We will use my-medium.cnf as this has been based on a web server where MySQL is not the primary role of the server but could have frequent use. If you are hosting a few sites with light use then use <code>my-small.cnf</code>.</p>
<p><code># cd /usr/share/doc/mysql-server-<br />
# cp my-medium.cnf /etc/my.cnf</code></p>
<p>Once this has overwritten my.cnf, the mysqld service must be restarted.</p>
<p><code># /etc/init.d/mysqld restart</code></p>
<p>Now the root password for MySQL must be set using the following command. Do NOT use the same root password as the Linux root password.</p>
<p><code># mysqladmin -u root password </code></p>
<p><strong>Setting up phpMyAdmin</strong></p>
<p>Administration of MySQL is carried out using phpMyAdmin which is a free open source software package licensed under the GNU. Nearly all hosting providers use this, and is pretty much the de-facto standard these days.</p>
<p>1) Download <a href="http://www.phpmyadmin.net" onclick="pageTracker._trackPageview('/outgoing/www.phpmyadmin.net?referer=');">phpMyAdmin</a>,<br />
2) Extract the contents to a directory called phpMyAdmin (case sensitive)<br />
3) Transfer the phpMyAdmin directory to /home/.sites/_default/web (Use FTP and login using the user you setup previously, as described in the Configuring FTP using VSFTPD section).</p>
<p>Now we need to configure the <code>confic.inc.php</code> file as follows:</p>
<p><code># vi /home/.sites/_default/web/phpMyAdmin/config.inc.php</code></p>
<p>Look for:</p>
<p><code>$cfg['Servers'][$i]['auth_type'] = 'config’;</code></p>
<p>Change ‘<code>config</code>’ to ‘<code>http</code>’ then restart MySQL.</p>
<p><code># /etc/init.d/mysqld restart</code></p>
<p>You should now be able to log into phpMyAdmin by going to http://www.mydomain.com/phpMyAdmin. Log on using ‘root’ and the password you specified for MySQL. You will now be presented with the phpMyAdmin web control panel. By default, MySQL contains a test database which is not required, so as a security measure, this needs to be deleted. To do this, click on ‘Databases’, then tick test. Click ‘Drop’ and then click ‘Yes’ to confirm.</p>
<p>When you are ready proceed to <a href="http://wp.rayheffer.com/106/building-a-secure-web-server-with-centos-5-part-3/" onclick="pageTracker._trackPageview('/outgoing/wp.rayheffer.com/106/building-a-secure-web-server-with-centos-5-part-3/?referer=');">part 3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rayheffer.com/91/building-a-secure-web-server-with-centos-5-part-2/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
