<?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>lejnieks &#187; CentOS</title>
	<atom:link href="http://www.lejnieks.com/tag/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lejnieks.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Jan 2010 19:22:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing Tomcat on CentOS</title>
		<link>http://www.lejnieks.com/2008/11/17/installing-tomcat-on-centos/</link>
		<comments>http://www.lejnieks.com/2008/11/17/installing-tomcat-on-centos/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:27:26 +0000</pubDate>
		<dc:creator>klejnieks</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Hudson]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Yum]]></category>

		<guid isPermaLink="false">http://lejnieks.com/?p=52</guid>
		<description><![CDATA[Continuing in setting up my CentOS server, the next thing I need is to get Hudson setup. Before I can get Hudson up and running I&#8217;ll need to get Tomcat installed. I could of course use Winstone which will get me up and running, but I know I will need Tomcat soon for some other [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing in setting up my CentOS server, the next thing I need is to get Hudson setup. Before I can get Hudson up and running I&#8217;ll need to get Tomcat installed. I could of course use <a href="http://winstone.sourceforge.net/">Winstone</a> which will get me up and running, but I know I will need Tomcat soon for some other things as well so might as well get it setup now.</p>
<p><span id="more-52"></span></p>
<p><strong>The Setup</strong></p>
<p>Install some base packages</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum install rpm-build gcc-java</span></pre></div></div>

<p>Add jpackage repository to your yum repos</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /etc/yum.repos.d/</span>
<span style="color: #666666; font-style: italic;"># wget https://jpackage.org/jpackage.repo</span>
<span style="color: #666666; font-style: italic;"># vi /etc/yum.repos.d/jpackage.repo</span></pre></div></div>

<p>set enabled = 1 on all repo files and save the .repo file. Next update yum.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum update</span></pre></div></div>

<p>Download and install some SRPMs.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /usr/local/src</span>
<span style="color: #666666; font-style: italic;"># wget ftp://jpackage.hmdc.harvard.edu/mirrors/JPackage/1.7/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm</span>
<span style="color: #666666; font-style: italic;"># wget ftp://jpackage.hmdc.harvard.edu/mirrors/JPackage/1.6/generic/non-free/SRPMS/jta-1.0.1-0.b.4jpp.nosrc.rpm</span></pre></div></div>

<p>Download some required files to /usr/src/redhat/SOURCES:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /usr/src/redhat/SOURCES</span></pre></div></div>

<p>Download jta-1_0_1B-classes.zip here after agreeing to the license.<br />
Download jdk-1_5_0_11-linux-i586.bin, again after agreeing to a license.<br />
Build and install the rpms.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># rpmbuild --rebuild /usr/local/src/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm</span>
<span style="color: #666666; font-style: italic;"># rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-1.5.0-11-1jpp.i586.rpm</span>
<span style="color: #666666; font-style: italic;"># rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-devel-1.5.0.11-1jpp.i586.rpm</span>
<span style="color: #666666; font-style: italic;"># rpmbuild --rebuild --without javadoc /usr/local/src/jta-1.0.1-0.b.4jpp.nosrc.rpm</span>
<span style="color: #666666; font-style: italic;"># rpm -ivh /usr/src/redhat/RPMS/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm</span></pre></div></div>

<p>Now install tomcat</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps</span></pre></div></div>

<p>note: if you get a dependency error at this point, like I did at first, try this solution for updating your jpackage-utils <a href="http://blog.sixsigns.com/2008/07/11/java-142-gcj-compati386-update-problem-on-centos/">http://blog.sixsigns.com/2008/07/11/java-142-gcj-compati386-update-problem-on-centos/</a> which basically is to install the <a href="http://dev.centos.org/centos/5/testing/i386/RPMS/jpackage-utils-1.7.5-1jpp.1.el5.centos.noarch.rpm">http://dev.centos.org/centos/5/testing/i386/RPMS/jpackage-utils-1.7.5-1jpp.1.el5.centos.noarch.rpm</a> package and update yum</p>
<p>At this point you should be able to navigate to your ip on port 8080 and see the default tomcat page</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lejnieks.com/2008/11/17/installing-tomcat-on-centos/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting up a CentOS server</title>
		<link>http://www.lejnieks.com/2008/11/17/setting-up-a-centos-server/</link>
		<comments>http://www.lejnieks.com/2008/11/17/setting-up-a-centos-server/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:14:49 +0000</pubDate>
		<dc:creator>klejnieks</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Hudson]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Webmin]]></category>

		<guid isPermaLink="false">http://lejnieks.com/?p=51</guid>
		<description><![CDATA[More recently I have been having some issues with Plesk, I&#8217;ve felt like I&#8217;ve been fighting with Plesk&#8217;s default generic templates and cookie cutter processes. What should be simple such as adding custom wars to Tomcat end up proving more times then not to be a royal pain. This passed month I ended up playing [...]]]></description>
			<content:encoded><![CDATA[<p>More recently I have been having some issues with Plesk, I&#8217;ve felt like I&#8217;ve been fighting with Plesk&#8217;s default generic templates and cookie cutter processes. What should be simple such as adding custom wars to Tomcat end up proving more times then not to be a royal pain. This passed month I ended up playing around with <a href="https://hudson.dev.java.net/">Hudson</a>, a Continous Integration server, and I found myself struggling through what should have been a seamless installation. Basically it took me 10 minutes to setup, install, and configure my first build in Hudson on my Mac but to be honest I ended up giving up after 3 days of struggling to get Hudson installed on my dedicated CentOS server that ran Plesk. Dont get me wrong, there are plenty of other things that bug me about Plesk but this latest thing was what ended up pushing me to get a basic server setup from scratch and configured exactly as I wanted it.</p>
<p><span id="more-51"></span></p>
<p>With that said, I would be remiss if I didn&#8217;t also mention that fact that, while I have some issue with plesk and its somewhat cookie cutter approach to web administration, it still is a great web administration tool for the most part.</p>
<p>My goal is basically to get a bare server up and running and administer-able without using Plesk or CPanel. The more I play around with this setup the more I will update the server section of this site with new configurations and additions as I learn them.</p>
<p><strong>Setting up a fresh CentOS server</strong></p>
<ol>
<li>Get a dedicated server from someone, I used <a href="http://aplus.net">aplus.net</a></li>
<li>Choose a basic installation, this means no plesk, cpanel etc&#8230; (keep in mind, eventually we will setup Webmin)</li>
<li>Start setting up your new box</li>
</ol>
<p><strong>The setup</strong><br />
shell into you server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ssh root@111.111.11.111</span></pre></div></div>

<p>Install LAMP (Linux Apache MySQL PHP) installed.<br />
You will do this using <a href="http://en.wikipedia.org/wiki/Yellow_dog_Updater,_Modified">yum</a>. Yum is an rpm wrapper that will allow you to install various services and applications with a lot more ease.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum -y install httpd</span>
<span style="color: #666666; font-style: italic;"># yum -y install php</span>
<span style="color: #666666; font-style: italic;"># yum -y install mysql</span>
<span style="color: #666666; font-style: italic;"># yum -y install mysql-server</span>
<span style="color: #666666; font-style: italic;"># yum -y install php-mysql</span></pre></div></div>

<p><em>note: the -y switch forces &#8220;yes&#8221; when prompted, so you don&#8217;t have to</em></p>
<p>Next configure the services you just installed to start automatically when the server restarts</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /sbin/chkconfig httpd on</span>
<span style="color: #666666; font-style: italic;"># /sbin/chkconfig --add mysqld</span>
<span style="color: #666666; font-style: italic;"># /sbin/chkconfig mysqld on</span>
<span style="color: #666666; font-style: italic;"># /sbin/service httpd start</span>
<span style="color: #666666; font-style: italic;"># /sbin/service mysqld start</span></pre></div></div>

<p>At this point, you now have mysql installed, but you will want to set up the mysql database root password. Without a password, any user on the box can login to mysql as database root. The mysql root account is a separate password from the machine root account.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mysqladmin -u root password 'new-password'</span></pre></div></div>

<p>At this point, some of you may be able to navigate to your public ip address and see the default CentOS page, I was not able to see this. Basically at this point, what I had was LAMP installed on my shiny new server but no one would ever know because port 80 was blocked.</p>
<p><strong>Enter iptables.</strong>..<br />
Iptables is your firewall, its baked into CentOS, and its extremely powerful. I don&#8217;t know the complete depth of iptables but for this tutorial you&#8217;ll need to just get a few ports opened up and that&#8217;s it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># iptables -F</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p udp -m udp --dport domain -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 22 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 10000 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 25 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 8080 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 80 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp -m tcp --dport domain -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A FORWARD -o eth0 -j LOG  --log-level 7 --log-prefix BANDWIDTH_OUT:</span>
<span style="color: #666666; font-style: italic;"># iptables -A FORWARD -i eth0 -j LOG  --log-level 7 --log-prefix BANDWIDTH_IN:</span>
<span style="color: #666666; font-style: italic;"># iptables -A OUTPUT -o eth0 -j LOG  --log-level 7 --log-prefix BANDWIDTH_OUT:</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -i eth0 -j LOG  --log-level 7 --log-prefix BANDWIDTH_IN:</span></pre></div></div>

<p>make sure you save your iptables configuration so you don&#8217;t have to re-edit it when you reboot your server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /sbin/service iptables save</span></pre></div></div>

<p>now just restart your firewall</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/iptables restart</span></pre></div></div>

<p>now you can check your configuration</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># iptables -L -v</span></pre></div></div>

<p>at this point, for good measure you might want to reboot your server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># reboot</span></pre></div></div>

<p>once your server reboots you should now be able to browse to your public IP address and get the default CentOS page.</p>
<p>you can learn more about iptables here: <a href="http://wiki.centos.org/HowTos/Network/IPTables">http://wiki.centos.org/HowTos/Network/IPTables</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lejnieks.com/2008/11/17/setting-up-a-centos-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Handy CruiseControl Commands</title>
		<link>http://www.lejnieks.com/2008/07/06/some-handy-cruisecontrol-commands/</link>
		<comments>http://www.lejnieks.com/2008/07/06/some-handy-cruisecontrol-commands/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 05:54:25 +0000</pubDate>
		<dc:creator>klejnieks</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CruiseControl]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://lejnieks.com/?p=21</guid>
		<description><![CDATA[Now that I have CruiseControl configured and running on my server I need a way to be able to stop/kill the processes, so I did some research and found this. To start CruiseControl # cd /opt/cruisecontrol-bin-2.6 &#160; # ./cruisecontrol.sh Top stop (aka Kill) CruiseControl use the UNIX command &#8216;ps&#8217; to view the processes and corresponding [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I have CruiseControl configured and running on my server I need a way to be able to stop/kill the processes, so I did some research and found this.<br />
<span id="more-21"></span><br />
To start CruiseControl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;"># cd /opt/cruisecontrol-bin-2.6</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ./cruisecontrol.sh</span></pre></div></div>

<p>Top stop (aka Kill) CruiseControl use the UNIX command &#8216;ps&#8217; to view the processes and corresponding process IDs as shown on <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=C28F09C4.5904%25pbh%40adobe.com&amp;forum_name=cruisecontrol-user">this post</a> on the source forge forums.</p>
<p>Find which PID (Process ID) you want to stop/kill type</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;"># ps -e</span></pre></div></div>

<p>I dont know what the <em>-e </em> switch is for but from what I can tell it displays all the running processes in the system as opposed to just <em>#ps</em> which displays a limited list. If you want a more verbose list the type in</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;">#ps -e -f</span></pre></div></div>

<p>(again I don&#8217;t know what the -f) switch is for, but it will return back to you even more information about the ongoing processes in your system. From here you can stop/kill the process you want based off the the displayed PID.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;"># kill -9 'XXXX'</span></pre></div></div>

<p>where &#8216;XXXX&#8217; is the associated PID for the CruiseControl process you want to kill</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lejnieks.com/2008/07/06/some-handy-cruisecontrol-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
