<?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>Ivan Villareal</title>
	<atom:link href="http://blog.ivanvillareal.info/tag/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ivanvillareal.info</link>
	<description>IT stuff and more...</description>
	<lastBuildDate>Fri, 13 Aug 2010 23:05:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up a new centos VPS server from console</title>
		<link>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/</link>
		<comments>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 00:36:30 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=185</guid>
		<description><![CDATA[How I did an initial configuration of a Centos 5.4 VPS server to have it working with virtual hosts.]]></description>
			<content:encoded><![CDATA[<p>I just got a couple of vps servers, that I have to configure to run some apps, this are the tasks I did to have them ready for production use:</p>
<p>&nbsp;</p>
<p>This servers didn’t came with a control panel (better for me), so the first thing I did was to login:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">ivan<span style="color: #000000; font-weight: bold;">@</span>mini:~$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>23.45.12.56</div></pre><!--END_DEVFMTCODE--></p>
<p>After this I checked the OS, version and architecture</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/*release*</span>
CentOS release <span style="color: #000000;">5.4</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Final<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># uname -a</span>
Linux V100205C4HB9V-<span style="color: #000000;">1</span> 2.6.18-028stab064.7 <span style="color: #666666; font-style: italic;">#1 SMP Wed Aug 26 13:11:07 MSD 2009 x86_64 x86_64 x86_64 GNU/Linux</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#</div></pre><!--END_DEVFMTCODE--></p>
<p>Ok, now that I know the OS I create a normal user to avoid using the root account.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># useradd –Gwheel ivan</div></pre><!--END_DEVFMTCODE--></p>
<p>Then I change the server name to mygdon</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i 's/V100205C4HB9V-1/mygdon/g' /etc/sysconfig/network</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i 's/V100205C4HB9V-1/mygdon/g' /etc/hosts</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo HOST.DOMAIN.com &gt; /etc/hostname</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># hostname -F /etc/hostname</div></pre><!--END_DEVFMTCODE--></p>
<p>Unfortunately I was unable to persist the new hostname, because it is a VPS server, there are ways around this, but didn’t have the time to make the changes so I just moved on, and leave this for later</p>
<p>The next thing I did was update the OS, and add the rpmforge repo because I will need some apps from there</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum update</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum upgrade</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm -Uhv rpmforge-release-0.5.1-1.$dist.rf.$arch.rpm</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum update</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum upgrade</div></pre><!--END_DEVFMTCODE--></p>
<p>Then I installed some packages I often use:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum install htop screen vim-enhanced</div></pre><!--END_DEVFMTCODE--></p>
<p>The VPS already had a web stack installed I just did some configuration:</p>
<h2>Configuring Apache Virtual Hosts</h2>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mkdir /var/www/vhosts/{site1, site2} –p</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi /etc/httpd/conf/httpd.conf</div></pre><!--END_DEVFMTCODE--></p>
<p>Here I Uncommented the following directive</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Apache configuration"><div class="devcodeoverflow"><span style="color: #00007f;">NameVirtualHost</span> *:<span style="color: #ff0000;">80</span></div></pre><!--END_DEVFMTCODE--></p>
<p>and Added a default vhost a new vhost</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Apache configuration"><div class="devcodeoverflow">&lt;<span style="color: #000000; font-weight:bold;">virtualhost</span> *:80&gt;
    <span style="color: #00007f;">DocumentRoot</span> /var/www/vhosts/default
    <span style="color: #00007f;">ServerName</span> mygdon.site1.net
    &lt;<span style="color: #000000; font-weight:bold;">directory</span> /var/www/vhosts/default&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">Indexes</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span>
    &lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
    <span style="color: #00007f;">ErrorLog</span> logs/mygdon.site1.net-error_log
    <span style="color: #00007f;">CustomLog</span> logs/mygdon.site1.net-access_log common
&lt;/<span style="color: #000000; font-weight:bold;">virtualhost</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">virtualhost</span> *:80&gt;
    <span style="color: #00007f;">DocumentRoot</span> /var/www/vhosts/site2
    <span style="color: #00007f;">ServerName</span> appname.site2.net
    &lt;<span style="color: #000000; font-weight:bold;">directory</span> /var/www/vhosts/site2&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">Indexes</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span>
    &lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
    <span style="color: #00007f;">ErrorLog</span> logs/appname.site2.net-error_log
    <span style="color: #00007f;">CustomLog</span> logs/appname.site2.net-access_log common
&lt;/<span style="color: #000000; font-weight:bold;">virtualhost</span>&gt;</div></pre><!--END_DEVFMTCODE--></p>
<p>then restarted the apache server:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># service httpd restart</span>
Stopping httpd:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Starting  httpd:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>and&nbsp; I wrote a simple php file to test this out:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo '&amp;lt;? phpinfo(); ?&amp;gt;' &gt; /var/www/vhosts/site1/index.php</div></pre><!--END_DEVFMTCODE--></p>
<p>And because I haven’t configured a DNS server I just temporarily added the server to my hosts file (On my local machine):</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow">root<span style="color: #339933;">@</span>mini<span style="color: #339933;">:/</span>etc<span style="color: #666666; font-style: italic;"># echo 'subdomain.site1.net 54.65.74.23' &gt; /etc/hosts</div></pre><!--END_DEVFMTCODE--></p>
<p>and here is the result:</p>
<p><a href="http://blog.ivanvillareal.info/wp-content/uploads/2010/02/testingvhost.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="testing-vhost" src="http://blog.ivanvillareal.info/wp-content/uploads/2010/02/testingvhost_thumb.png" border="0" alt="testing-vhost" width="644" height="379" /></a>&nbsp;</p>
<h2>Configuring Mysql</h2>
<p>Once I had the virtual hosts configuration in place I added a mysql user and changed the default root password:</p>
<p>&nbsp;</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="MySQL"><div class="devcodeoverflow"><span style="color: #FF00FF;">&#91;</span>root@V100205C4HB9V<span style="color: #CC0099;">-</span><span style="color: #008080;">1</span> vhosts<span style="color: #FF00FF;">&#93;</span><span style="color: #808080; font-style: italic;"># mysql</span>
Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> 5
Server <span style="color: #000099;">version</span>: 5.0.77 Source distribution
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the <span style="color: #00CC00;">buffer</span>.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">show</span> <span style="color: #990099; font-weight: bold;">databases</span><span style="color: #000033;">;</span>
<span style="color: #CC0099;">+--------------------+</span>
<span style="color: #CC0099;">|</span> <span style="color: #990099; font-weight: bold;">Database</span>           <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+--------------------+</span>
<span style="color: #CC0099;">|</span> information_schema <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> mysql              <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> test               <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+--------------------+</span>
3 rows <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">UPDATE</span> mysql.<span style="color: #000099;">user</span> <span style="color: #990099; font-weight: bold;">SET</span> <span style="color: #000099;">Password</span><span style="color: #CC0099;">=</span><span style="color: #000099;">PASSWORD</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'pass-here'</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #000099;">user</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'root'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 3 rows affected <span style="color: #FF00FF;">&#40;</span>0.02 sec<span style="color: #FF00FF;">&#41;</span>
Rows matched: 3  Changed: 3  <span style="color: #990099; font-weight: bold;">Warnings</span>: 0
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.01 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'pass-here'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.01 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'pass-here'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>&nbsp;</p>
<p>Now the server is&nbsp; ready for adding some virtual hosts, I just need to configure a DNS server and the mail server, but because the DNS is on another server and already working I just have to add a new zone, as for mail server, this server will be only used to send emails so I don’t need to dig in postfix configuration files for now.</p>
<p>I&#8217;ll write another post regarding the security, but for now this will work.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Mysql5 and PHP5 on centos4</title>
		<link>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/</link>
		<comments>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 19:00:06 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=76</guid>
		<description><![CDATA[I have the need to install php5 and mysql 5 on a centos 4 server, so I found that the Centos Plus repository had this, and this is what I did to get these two working.
First check what is the version of the distro:
cat /etc/*release*
Then make an update:
yum update
After 496 package updates I&#8217;ve installed php5
yum [...]]]></description>
			<content:encoded><![CDATA[<p>I have the need to install php5 and mysql 5 on a centos 4 server, so I found that the Centos Plus repository had this, and this is what I did to get these two working.</p>
<p>First check what is the version of the distro:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/*</span>release<span style="color: #000000; font-weight: bold;">*</span></div></pre><!--END_DEVFMTCODE--></p>
<p>Then make an update:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum update</div></pre><!--END_DEVFMTCODE--></p>
<p>After 496 package updates I&#8217;ve installed php5<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> php</div></pre><!--END_DEVFMTCODE--></p>
<p>This were the installed packages:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">php-5.1.6-3.el4s1.10
php-cli-5.1.6-3.el4s1.10
php-common-5.1.6-3.el4s1.10
</div></pre><!--END_DEVFMTCODE--></p>
<p>So I&#8217;ve created a info.php file, and restarted the apache server:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php phpinfo(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>info.php <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> service httpd restart</div></pre><!--END_DEVFMTCODE--></p>
<p>It was working correctly, so the next thing was to have mysql 5 in it, so I did:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server</div></pre><!--END_DEVFMTCODE--></p>
<p>I got some problems here, first I got this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">Transaction Check Error: <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>Index.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>README from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>armscii8.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>ascii.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4</div></pre><!--END_DEVFMTCODE--></p>
<p>So what I found was that yum was trying to install mysql.i386 but the architechture is x86_64, to fix this I had to specify the arch<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> mysql.x86_64 mysql-server</div></pre><!--END_DEVFMTCODE--></p>
<p>After this I was able to install it, but when I tried to start the server I received some errors about error messages not right, I&#8217;ve checked the installed packages and it was installed mysqlclient10, so I removed the error messages problem disappeared, however I still couldn&#8217;t startup the server, checking at the logs I found this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
091012 11:01:18  InnoDB: Started; log sequence number <span style="color: #000000;">0</span> <span style="color: #000000;">0</span>                       091012 <span style="color: #000000;">11</span>:01:<span style="color: #000000;">18</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ERROR<span style="color: #7a0874; font-weight: bold;">&#93;</span> Fatal error: Can<span style="color: #ff0000;">'t open and lock privilege tables: Table '</span>mysql.host<span style="color: #ff0000;">' doesn'</span>t exist                                                     091012 <span style="color: #000000;">11</span>:01:<span style="color: #000000;">18</span>  mysqld ended                                               </div></pre><!--END_DEVFMTCODE-->\</p>
<p>To fix this I cleared the data dir, that had som files, this was in &#8216;/var/lib/mysql&#8217; and after that I ran mysql_install_db:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /var/lib/mysql </span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rm -rf *</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysql_install_db --user=mysql -ldata=/var/lib/mysql</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># service mysqld start</div></pre><!--END_DEVFMTCODE--></p>
<p>After the server was up, I changed the root password and added a new user:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysqladmin -u root password NEWPASSWORD</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysql -pNEWPASSWORD</span>
&nbsp;
</div></pre><!--END_DEVFMTCODE--><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="MySQL"><div class="devcodeoverflow">Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> 5
Server <span style="color: #000099;">version</span>: 5.0.82sp1 Source distribution
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the current input statement.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span> MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 <span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> flush <span style="color: #990099; font-weight: bold;">privileges</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> exit
Bye
&nbsp;
&nbsp;
</div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->
