<?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>LINUX For You &#187; Servers</title> <atom:link href="http://www.linuxforu.com/category/how-to/servers/feed/" rel="self" type="application/rss+xml" /><link>http://www.linuxforu.com</link> <description>The Complete Magazine on Open Source</description> <lastBuildDate>Tue, 31 Jan 2012 17:22:40 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Setting up a LAMP Server Remotely</title><link>http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-a-lamp-server-remotely</link> <comments>http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/#comments</comments> <pubDate>Wed, 28 Dec 2011 13:40:12 +0000</pubDate> <dc:creator>Siddharth Mankad</dc:creator> <category><![CDATA[For You & Me]]></category> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[CMS]]></category> <category><![CDATA[DHCP]]></category> <category><![CDATA[FTP]]></category> <category><![CDATA[LAMP]]></category> <category><![CDATA[LFY December 2011]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[OpenSSH Server]]></category> <category><![CDATA[os installation]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[phpBB]]></category> <category><![CDATA[phpMyAdmin]]></category> <category><![CDATA[putty]]></category> <category><![CDATA[server machine]]></category> <category><![CDATA[ubuntu]]></category> <category><![CDATA[vsftpd]]></category> <category><![CDATA[Web]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=8499</guid> <description><![CDATA[It&#8217;s been said a million times over &#8212; Linux is awesome on servers! With over 60 per cent of the Web&#8217;s servers gunning away on the mighty penguin, the robust, resilient, scalable and...]]></description> <content:encoded><![CDATA[<p><img class="alignright size-full wp-image-8505" title="LAMP time!" src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/lamp-server.jpg?d9c344" alt="LAMP time!" width="350" height="306" /><div class="introduction">It&#8217;s been said a million times over &#8212; Linux is awesome on servers! With over 60 per cent of the Web&#8217;s servers gunning away on the mighty penguin, the robust, resilient, scalable and stable Linux plays a major role in keeping the Internet running like a well-oiled machine. In this article, I will describe how to set up a LAMP (Linux, Apache, MySQL and PHP) server from scratch, remotely. The only step requiring physical access is installing Ubuntu Server. The rest can be done the geeky way, via SSH! Read on if getting your hands dirty gives you a kick!</div><p>Let us first install Ubuntu Server, and then, from another system, connect using the PuTTY SSH client to install FTP support and phpMyAdmin, and get a phpBB website up and running.</p><h2>Setting up Ubuntu Server</h2><p>Download the ISO from the <a href="http://www.ubuntu.com/business/server/overview">Ubuntu website</a>. Burn a CD, or prepare a USB boot disk, as per your preference. Boot the server machine from it. The boot menu is shown in Figure 1. Select Install to the Hard Disk. The installer will boot and ask you to select your language. Select English and continue.</p><div id="attachment_8500" class="wp-caption aligncenter" style="width: 540px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/1.png?d9c344" alt="Ubuntu Server boot menu" title="Ubuntu Server boot menu" width="540" height="358" class="size-full wp-image-8500" /><p class="wp-caption-text">Figure 1: Ubuntu Server boot menu</p></div><p>I will fly through the next few screens, since they&#8217;re all what you usually see during any standard OS installation. For the keyboard layout, the default US layout works for us. The installer will then load components and configure hardware. It will also try to configure the network interface using DHCP. If that fails, you will be asked to manually enter network information like Host IP, Gateway, Subnet Mask, etc. It will also prompt you to enter the hostname; use a name you would like the server to be known by on the network. For this article, I have used &#8216;mylamp&#8217; with IP address 210.22.23.24.</p><p>Next comes partitioning. I used the Erase Entire Disk option; if you have any specific partitioning requirements, feel free to use Manual partitioning. After this stage, under Clock Configuration, you will be asked about your system time setting. The new user (non-root) creation screen is next; enter your full name, user name (I used &#8216;lampuser&#8217;) and password.</p><p>The installer will now show you a software selection screen; select LAMP Server and OpenSSH Server.<br /> Wait as the progress bars fill up &#8212; first for the base system, then for the package installation, and then for the GRUB bootloader. Once all these are done, it will tell you that it is time to reboot and take your new server for a ride!</p><div id="attachment_8501" class="wp-caption aligncenter" style="width: 582px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/2.png?d9c344" alt="Reboot prompt" title="Reboot prompt" width="582" height="154" class="size-full wp-image-8501" /><p class="wp-caption-text">Figure 2: Reboot prompt</p></div><p>Server installation is now complete. Remove the disc and return to your desktop. Let us now remotely configure the server for a LAMP website.</p><h2>Preparing for deployment</h2><p>Whether your desktop runs Windows or Linux, you can use the PuTTY SSH client. <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Download it</a>, fire it up, and enter the connection details for your server (Figure 3).</p><div id="attachment_8502" class="wp-caption aligncenter" style="width: 447px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/3.png?d9c344" alt="PuTTY connection screen" title="PuTTY connection screen" width="447" height="378" class="size-full wp-image-8502" /><p class="wp-caption-text">Figure 3: PuTTY connection screen</p></div><p>Click Open to connect to the server. This will bring up a terminal prompt that asks you to enter the username. It may throw up an error similar to the one in Figure 4. Just click on Yes. Once the password is accepted, you will be greeted with a shell prompt. The first thing to do is set up a FTP server so we can upload files to the server. Next, let us install phpMyAdmin to manipulate MySQL databases.</p><div id="attachment_8503" class="wp-caption aligncenter" style="width: 411px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/4.png?d9c344" alt="Server host key alert" title="Server host key alert" width="411" height="268" class="size-full wp-image-8503" /><p class="wp-caption-text">Figure 4: Server host key alert</p></div><h3>FTP service</h3><p>FTP support is by the <code>vsftp</code> daemon; installation is straightforward: <code>sudo apt-get install vsftpd</code>. After installation, tweak the configuration file to point the default path to <code>/var/www</code> (the Apache &#8216;Webroot&#8217; for hosted content/sites). Edit <code>/etc/vsftpd.conf</code> as the root user, with a text editor and Make sure the settings match those shown below:</p><pre class="brush: text; gutter: false">
write_enable=YES
local_enable=YES
local_root=/var/www
file_open_mode=0777</pre><p>Restart the FTP service to bring the configuration changes into effect: <code>sudo restart vsftpd</code>.</p><h3>Installing phpMyAdmin</h3><p>phpMyAdmin is a great tool for administering MySQL databases. Install it using the following command: <code>sudo apt-get install phpmyadmin</code>.<br /> We can now exit the PuTTY session, using the exit command.</p><h2>Deploying a LAMP website</h2><p>For the purpose of this article, let us deploy a standard version of phpBB &#8212; the most famous AMP-powered bulletin board system and forum content management system (CMS). I will not go into the installation details, since the aim here is to learn how to generally deploy a LAMP website remotely &#8212; however, you can refer to this <a href="http://www.linuxforu.com/2011/07/set-up-your-own-forum-using-phpbb/" title="Set Up Your Own Forum Using phpBB">article for installation instructions</a>. Download the archive from the phpBB home page and extract its contents.</p><p>Now, using an FTP client, connect to the server with the username and the password used in the PuTTY session. Create a folder called phpBB on the server, and copy the extracted files and folders to the root of that directory. Open a browser and navigate to <code>http://210.22.23.24/phpmyadmin</code> (replace the IP address with yours) to bring up the phpMyAdmin page (Figure 5).</p><div id="attachment_8504" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/12/5.png?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/5-590x296.png?d9c344" alt="phpMyAdmin status page" title="phpMyAdmin status page" width="590" height="296" class="size-large wp-image-8504" /></a><p class="wp-caption-text">Figure 5: phpMyAdmin status page</p></div><p>Create a new database named <code>phpbb</code> &#8212; go to the Database tab and use the Create New Database section at the bottom. You can now proceed to a site-specific installation by navigating to <code>http://210.22.23.24/phpbb</code>. Follow the instructions on the page.</p><p>We have now successfully set up our server, and learnt how to remotely control it! I hope you had fun learning, during this process. Until next time, cheers!<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/07/set-up-your-own-forum-using-phpbb/" rel="bookmark" class="crp_title">Set Up Your Own Forum Using phpBB</a></li><li><a href="http://www.linuxforu.com/2011/06/lamp-server-in-10-minutes-turnkey/" rel="bookmark" class="crp_title">Turnkey: Build LAMP Server in Under 10 Minutes</a></li><li><a href="http://www.linuxforu.com/2011/04/demystifying-the-cloud-with-eyeos/" rel="bookmark" class="crp_title">Demystifying the Cloud with eyeOS</a></li><li><a href="http://www.linuxforu.com/2009/03/install-linux-straight-from-an-iso/" rel="bookmark" class="crp_title">Stop Wasting CDs; Install Linux Straight from an ISO</a></li><li><a href="http://www.linuxforu.com/2011/05/quick-quide-to-qemu-setup/" rel="bookmark" class="crp_title">The Quick Guide to QEMU Setup</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/apache/" title="Apache" rel="tag">Apache</a>, <a href="http://www.linuxforu.com/tag/cms/" title="CMS" rel="tag">CMS</a>, <a href="http://www.linuxforu.com/tag/dhcp/" title="DHCP" rel="tag">DHCP</a>, <a href="http://www.linuxforu.com/tag/ftp/" title="FTP" rel="tag">FTP</a>, <a href="http://www.linuxforu.com/tag/lamp/" title="LAMP" rel="tag">LAMP</a>, <a href="http://www.linuxforu.com/tag/lfy-december-2011/" title="LFY December 2011" rel="tag">LFY December 2011</a>, <a href="http://www.linuxforu.com/tag/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://www.linuxforu.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.linuxforu.com/tag/openssh-server/" title="OpenSSH Server" rel="tag">OpenSSH Server</a>, <a href="http://www.linuxforu.com/tag/os-installation/" title="os installation" rel="tag">os installation</a>, <a href="http://www.linuxforu.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.linuxforu.com/tag/phpbb/" title="phpBB" rel="tag">phpBB</a>, <a href="http://www.linuxforu.com/tag/phpmyadmin/" title="phpMyAdmin" rel="tag">phpMyAdmin</a>, <a href="http://www.linuxforu.com/tag/putty/" title="putty" rel="tag">putty</a>, <a href="http://www.linuxforu.com/tag/server-machine/" title="server machine" rel="tag">server machine</a>, <a href="http://www.linuxforu.com/tag/ubuntu/" title="ubuntu" rel="tag">ubuntu</a>, <a href="http://www.linuxforu.com/tag/vsftpd/" title="vsftpd" rel="tag">vsftpd</a>, <a href="http://www.linuxforu.com/tag/web-news/" title="Web" rel="tag">Web</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Supercharge Your Self-Hosted WordPress Blog with Nginx &amp; FastCGI</title><link>http://www.linuxforu.com/2011/12/supercharge-wordpress-with-nginx-fastcgi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=supercharge-wordpress-with-nginx-fastcgi</link> <comments>http://www.linuxforu.com/2011/12/supercharge-wordpress-with-nginx-fastcgi/#comments</comments> <pubDate>Wed, 28 Dec 2011 07:00:59 +0000</pubDate> <dc:creator>Boudhayan Gupta</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[Tools / Apps]]></category> <category><![CDATA[.htaccess]]></category> <category><![CDATA[AMP]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[CentOS]]></category> <category><![CDATA[concurrent connections]]></category> <category><![CDATA[FastCGI]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Threads]]></category> <category><![CDATA[ubuntu]]></category> <category><![CDATA[VPS]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[Web servers]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=8456</guid> <description><![CDATA[If you are running WordPress on a VPS, you&#8217;ve got all the power in the world to run the site exactly the way you want. If you know how to use that power,...]]></description> <content:encoded><![CDATA[<p><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/12/wordpress-logo.jpg?d9c344" alt="Supercharged WordPress" title="Supercharged WordPress" width="350" height="350" class="alignright size-full wp-image-8457" /><div class="introduction">If you are running WordPress on a VPS, you&#8217;ve got all the power in the world to run the site exactly the way you want. If you know how to use that power, you can be serving tens of thousands of visitors using a 256MB VPS account. Amazed? Read on!</div><p>WordPress runs on something knows as an AMP (Apache, MySQL, PHP) stack. Apache is your web server software. MySQL is your database engine. And PHP is the language WordPress is written in. Out of these three, the web server is the only component that you can replace with something else. Most people use Apache just because it&#8217;s very simple to set up &#8212; and that WordPress supports it out of the box. But what if you could tweak around and install another web server that is immensely faster than Apache?</p><p>Enter <a href="http://wiki.nginx.org">Nginx</a>. Pronounced Engine X (Engine 10), this web server software was created by a Russian developer to solve something known as the <a href="http://www.kegel.com/c10k.html">C10K problem</a>. Most traditional Web servers (Apache included) uses threads to serve each request. I know this is kind of technical, but you&#8217;ll see &#8212; creating new threads is a very expensive operation for operating systems, and there&#8217;s a limit to the number of threads that can can be spawned. As such, the theoretical limit for Apache is 10,000 concurrent connections.</p><p>Nginx is a breed of new Web servers that use an event-driven technique to Web serving. Jobs are performed asynchronously (which basically means that tasks are executed in parallel, and that one task doesn&#8217;t have to complete for the next to commence) &#8212; which makes it immensely fast. Every new connection uses a small, and more importantly predictable amount of memory. The end result? A fast Web server which uses very less memory, and can serve more than 10,000 connections concurrently.</p><p>&#8216;Nuff said.</p><h2>Will WordPress Like Nginx?</h2><p>Good question. One of WordPress&#8217;s quirks is that it uses files named <code>.htaccess</code> (which is an Apache-specific feature) which are used to control redirections if you use pretty permalinks. If you don&#8217;t use pretty permalinks (e.g., your blog has links like <code>www.myblog.com/index.php?p=100&amp;d=200</code>) then you&#8217;re pretty much set. If you do use pretty permalinks, (like <code>www.myblog.com/2011/01/01/happy-new-year.html</code>) then you&#8217;ll need some additional configuration (which I&#8217;m going to show you here).</p><p>Now there&#8217;s another problem. WordPress is very extensible, which means it supports plugins. WordPress itself doesn&#8217;t rely much on <code>.htaccess</code> files other than to handle redirections, but plugins may use it to handle access-control and permissions. Now the list of such plugins is infinitesimally small, and any such plugin which uses <code>.htaccess</code> files is badly designed anyway, since plugins shouldn&#8217;t make assumptions about the Web server its running under, but if you must use those plugins, then you&#8217;ll either have to do without the access-control (you can <code>chmod</code> the files appropriately), or you&#8217;ll have to do without Nginx.</p><p>Us? We still aren&#8217;t big enough to warrant moving to VPS, so we use whatever server out hosting provider provides. But here&#8217;s some trivia for you &#8212; <a href="http://www.wordpress.com/">WordPress.com</a> itself runs on Nginx.</p><h2>Getting Started</h2><p>I&#8217;m assuming you&#8217;ve got a VPS with Apache, MySQL and PHP already hosting your blog. What we&#8217;ll do is install Nginx and the PHP connector, and switch the site over from Apache to Nginx in a single step that will typically involve less than a second of downtime.</p><p>Most servers run either Debian/Ubuntu Server or RHEL/CentOS. If you&#8217;re one of the lucky ones to afford SUSE Linux Enterprise, you&#8217;ll have to figure out how to install Nginx yourself.</p><p>Nginx development takes place very fast. For this reason, your distribution binaries are generally going to be way out of date. But there&#8217;s a way out &#8212; Nginx provides official repositories (yes, complete repos, not just binaries) for many operating systems.</p><p>If you run Debian Squeeze, add these lines to your <code>/etc/apt/sources.list</code>:</p><pre class="brush: text; gutter: false">deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx</pre><p>If you run Ubuntu Server, the lines for <code>/etc/apt/sources.list</code> are:</p><pre class="brush: text; gutter: false">deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx</pre><p>Needless to say, you should be running the LTS version of Ubuntu Server. Nginx also has official versions for RHEL and CentOS. To add their Yum repo, create a new repo file at /etc/yum.repos.d/nginx.repo<span id="more-8456"></span> with the contents (for CentOS):</p><pre class="brush: text; gutter: false">[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1</pre><p>And for RHEL:</p><pre class="brush: text; gutter: false">[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1</pre><p>Now you can install Nginx using your package manager. For Debian/Ubuntu, run:</p><pre class="brush: text; gutter: false">sudo apt-get update &amp;&amp; sudo apt-get install nginx</pre><p>You&#8217;ll get Certificate errors for Nginx because <code>apt</code> does not automatically add certificates for repositories. The certificate links are in the Appendix section at the end of this article. Anyway, for RHEL/CentOS, run:</p><pre class="brush: text; gutter: false">sudo yum install nginx</pre><p>You now have Nginx. You&#8217;ll have to install the PHP FastCGI connector now.</p><p>You&#8217;ll need to add a repository if you&#8217;re on Debian Squeeze. Add these lines to the <code>/etc/sources.list</code> file:</p><pre class="brush: text; gutter: false">deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all</pre><p>You&#8217;ll also need to add a repository if you&#8217;re on RHEL/CentOS 5. Run the following commands:</p><pre class="brush: text; gutter: false">sudo rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
sudo yum --enablerepo=webtatic update</pre><p>Now, to install, on Debian/Ubuntu type:</p><pre class="brush: text; gutter: false">sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade
sudo apt-get install php-fpm</pre><p>And on CentOS/RHEL, type:</p><pre class="brush: text; gutter: false">sudo yum --enablerepo=webtatic install php-fpm</pre><p>You&#8217;re officially on the road. All you need to do now is configure Nginx, start <code>php-fpm</code>, and then in one step stop Apache and start Nginx.</p><h2>Configuring Nginx</h2><p>I&#8217;m assuming your Webroot is at <code>/var/www</code>. If not, adjust the following file appropriately. Open up the file <code>/etc/nginx/sites-available/default</code>, and replace everything in there with the following:</p><pre class="brush: text; gutter: false">server {
    listen       192.168.1.1:80;                # Your server&#039;s public IP address
    server_name  example.com;                   # Your domain name
    root         /var/www/;                     # Absolute path to your WordPress installation

    try_files $uri $uri/ /index.php;            # Handle permalinks
    if (!-e $request_filename) {
          rewrite ^.*$ /index.php last;         # More code to handle permalinks
    }                                           # This is what the HTACCESS is basically for

    location ~ \.php$ {
        include        fastcgi_params;
        fastcgi_pass   localhost:9000;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}</pre><p>That&#8217;s it. Now, we&#8217;ve got to start <code>php-fpm</code>, by doing:</p><pre class="brush: text; gutter: false">sudo /etc/init.d/php-fpm start</pre><p>And then in one fell swoop, switch the Web server:</p><pre class="brush: text; gutter: false">sudo /etc/init.d/httpd stop &amp;&amp; sudo /etc/init.d/nginx restart</pre><p>Don&#8217;t worry about the restart thing in the last command &#8212; some ditributions think its really cool to start nginx on port 8000 as soon as is it&#8217;s installed.</p><p>Now access your site. Happy?</p><p>You can now go ahead and remove all Apache packages from your system. That should be it. Oh, you should go ahead and install <a title="Ngnix Compatibility Plugin" href="http://wordpress.org/extend/plugins/nginx-compatibility/">this</a> plugin.</p><h5>What If It Doesn&#8217;t Work?</h5><p>Leave Comment below, and we&#8217;ll help you out.</p><h5>Appendix: Certificates For Debian/Ubuntu</h5><p>To add the DotDeb certificate, do:</p><pre class="brush: text; gutter: false">wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | sudo apt-key add -</pre><p>And to add the Nginx certificate, do:</p><pre class="brush: text; gutter: false">gpg --recv-key 7BD9BF62
gpg --armor --export 7BD9BF62 | sudo apt-key add -</pre><div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/07/wordpress-multi-site-servers-on-production-machines/" rel="bookmark" class="crp_title">WordPress Multi-site Servers on Production Machines</a></li><li><a href="http://www.linuxforu.com/2009/02/building-a-highly-available-web-server-cluster/" rel="bookmark" class="crp_title">Building A Highly-Available Web Server Cluster</a></li><li><a href="http://www.linuxforu.com/2011/05/linux-kernel-development-using-git/" rel="bookmark" class="crp_title">Linux Kernel Development Using Git</a></li><li><a href="http://www.linuxforu.com/2009/03/building-a-highly-available-nginx-reverse-proxy-using-heartbeat/" rel="bookmark" class="crp_title">Building A Highly Available Nginx Reverse-Proxy Using Heartbeat</a></li><li><a href="http://www.linuxforu.com/2011/09/openindiana-review-free-solaris-fork/" rel="bookmark" class="crp_title">OpenIndiana &#8212; a Free Fork of Solaris</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/htaccess/" title=".htaccess" rel="tag">.htaccess</a>, <a href="http://www.linuxforu.com/tag/amp/" title="AMP" rel="tag">AMP</a>, <a href="http://www.linuxforu.com/tag/apache/" title="Apache" rel="tag">Apache</a>, <a href="http://www.linuxforu.com/tag/centos/" title="CentOS" rel="tag">CentOS</a>, <a href="http://www.linuxforu.com/tag/concurrent-connections/" title="concurrent connections" rel="tag">concurrent connections</a>, <a href="http://www.linuxforu.com/tag/fastcgi/" title="FastCGI" rel="tag">FastCGI</a>, <a href="http://www.linuxforu.com/tag/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://www.linuxforu.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.linuxforu.com/tag/nginx/" title="nginx" rel="tag">nginx</a>, <a href="http://www.linuxforu.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.linuxforu.com/tag/threads/" title="Threads" rel="tag">Threads</a>, <a href="http://www.linuxforu.com/tag/ubuntu/" title="ubuntu" rel="tag">ubuntu</a>, <a href="http://www.linuxforu.com/tag/vps/" title="VPS" rel="tag">VPS</a>, <a href="http://www.linuxforu.com/tag/web-news/" title="Web" rel="tag">Web</a>, <a href="http://www.linuxforu.com/tag/web-servers/" title="Web servers" rel="tag">Web servers</a>, <a href="http://www.linuxforu.com/tag/wordpress/" title="WordPress" rel="tag">WordPress</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/12/supercharge-wordpress-with-nginx-fastcgi/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Storage Management using Openfiler, Part 4</title><link>http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storage-management-using-openfiler-part-4</link> <comments>http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/#comments</comments> <pubDate>Mon, 31 Oct 2011 18:36:11 +0000</pubDate> <dc:creator>Rajesh Deodhar</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[Ethernet]]></category> <category><![CDATA[ethernet devices]]></category> <category><![CDATA[file server]]></category> <category><![CDATA[File Sharing]]></category> <category><![CDATA[hard disks]]></category> <category><![CDATA[HTTP/DAV]]></category> <category><![CDATA[individual computer]]></category> <category><![CDATA[internet engineering task force]]></category> <category><![CDATA[Internet Small Computer Systems]]></category> <category><![CDATA[iSCSI]]></category> <category><![CDATA[iscsi initiator]]></category> <category><![CDATA[LFY November 2011]]></category> <category><![CDATA[local network]]></category> <category><![CDATA[network interface]]></category> <category><![CDATA[network transport protocols]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[SCSI]]></category> <category><![CDATA[scsi layer]]></category> <category><![CDATA[scsi protocol]]></category> <category><![CDATA[scsi standard]]></category> <category><![CDATA[speed peripherals]]></category> <category><![CDATA[storage device]]></category> <category><![CDATA[storage management]]></category> <category><![CDATA[TCP/IP]]></category> <category><![CDATA[virtual machine]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5658</guid> <description><![CDATA[In the previous article in the series on Openfiler, we discussed configuring RAID. Here, we will proceed with the installation and configuration of iSCSI. This article assumes that Openfiler 2.3 has been configured...]]></description> <content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-5659" title="Openfiler" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/openfiler-4-350x287.jpg?d9c344" alt="Openfiler" width="350" height="287" /></p><div class="introduction">In the <a href="http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/" title="Storage Management using Openfiler, Part 3">previous article</a> in the series on Openfiler, we discussed configuring RAID. Here, we will proceed with the installation and configuration of iSCSI. This article assumes that Openfiler 2.3 has been configured and is operational. Please refer to the <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">August</a>, <a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" title="Storage Management using Openfiler, Part 2">September</a> and <a href="http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/" title="Storage Management using Openfiler, Part 3">October</a> articles for more details.</div><p>Before installing iSCSI (Internet Small Computer Systems Interface) on Openfiler, let&#8217;s cover some of its basics.</p><p>The SCSI standard is used to connect high-speed peripherals (especially hard disks) to computers. It can connect up to seven devices to a single controller. Over a period of time, the requirements have changed to connect various devices on a network rather than on an individual computer. This required the SCSI protocol to be mapped to network transport protocols.</p><p>iSCSI enables SCSI packets to be transferred over TCP/IP (Ethernet). Just think about it &#8212; iSCSI enables access to disks across the network &#8212; not only to the local network, but even across the Internet. iSCSI requires an initiator (the client system, in this case, a desktop PC) and a target (the storage device &#8212; here, Openfiler).</p><p>SCSI data is transferred via an iSCSI session in five layers. The bottom three layers, Transport (TCP), Internet (IP) and Network Interface (Link) belong to the TCP/IP stack. iSCSI sits between the SCSI and transport layer, encapsulating and de-encapsulating packets.</p><p>Consider a case of a write cycle &#8212; the iSCSI initiator will send SCSI packets through the SCSI layer down to the Link layer. After data transfer to the target, it will go up from the Link layer to the SCSI layer to be written on the disk. The many important benefits of iSCSI are:</p><ul><li>It uses standard Ethernet devices and works on TCP/IP</li><li>It eliminates distance limitations; remote replication over the Internet is possible</li><li>It is documented in RFC3720 by the IETF (Internet Engineering Task Force)</li><li>It is supported by Intel, Cisco, various Linux flavours and other OSs</li></ul><h2>Creating an iSCSI target</h2><p>Let&#8217;s now proceed to the installation of an iSCSI target in Openfiler. Open the Openfiler Web interface; proceed to Services &#8211;&gt; iSCSI Target Server and enable the service. To create an iSCSI volume: Volume &#8211;&gt; Add Volume &#8211;&gt; Volume Name iSCSI1 &#8211;&gt; 100000 MB &#8211;&gt; Volume type &#8211;&gt; iSCSI. Add a new iSCSI target from Volumes &#8211;&gt; Target. (See Figure 1; I used the default target name, you can edit and change it, if required.)</p><div id="attachment_5663" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot1-Add-new-iSCSI-Target.jpg?d9c344"><img class="size-large wp-image-5663" title="Add new iSCSI target" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot1-Add-new-iSCSI-Target-590x255.jpg?d9c344" alt="Add new iSCSI target" width="590" height="255" /></a><p class="wp-caption-text">Figure 1: Add new iSCSI target</p></div><p>The target now needs to be mapped to a LUN (Logical Unit Number) used to identify a SCSI disk, from a stack of a maximum of seven disks. Click the MAP button to complete this step (Figure 2).</p><div id="attachment_5664" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot2-LUN-Mapping.jpg?d9c344"><img class="size-large wp-image-5664" title="LUN Mapping" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot2-LUN-Mapping-590x304.jpg?d9c344" alt="LUN Mapping" width="590" height="304" /></a><p class="wp-caption-text">Figure 2: LUN Mapping</p></div><p>Under Network ACL, allow access to the required network subnet. Complete the setup by assigning the CHAP Authentication username and password (Figure 3).</p><div id="attachment_5665" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot3-CHAP-Authentication.jpg?d9c344"><img class="size-large wp-image-5665" title="CHAP Authentication" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot3-CHAP-Authentication-590x390.jpg?d9c344" alt="CHAP Authentication" width="590" height="390" /></a><p class="wp-caption-text">Figure 3: CHAP Authentication</p></div><p>The Openfiler iSCSI set-up is now complete.</p><h2>The client setup</h2><p>Download and install iSCSI Initiator on your client box. Go to the Discovery tab and add a target portal (the IP address and default port 3260). See Figure 4.</p><div id="attachment_5666" class="wp-caption aligncenter" style="width: 406px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot4-Add-Target-Portal.jpg?d9c344"><img class="size-full wp-image-5666" title="Add target portal" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot4-Add-Target-Portal.jpg?d9c344" alt="Add target portal" width="406" height="467" /></a><p class="wp-caption-text">Figure 4: Add target portal</p></div><p>Proceed by clicking on Targets &#8211;&gt; Logon &#8211;&gt; Advanced &#8211;&gt; CHAP logon information &#8211;&gt; User name and Password as defined earlier in iSCSI target setup in Openfiler (see Figure 5).</p><div id="attachment_5667" class="wp-caption aligncenter" style="width: 403px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot5-CHAP-logon-information.jpg?d9c344"><img class="size-full wp-image-5667" title="CHAP log-on information" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot5-CHAP-logon-information.jpg?d9c344" alt="CHAP log-on information" width="403" height="510" /></a><p class="wp-caption-text">Figure 5: CHAP log-on information</p></div><p>You should see the new device detected. Format the device, make partitions, format them, and start using your Openfiler iSCSI drive as if it were a local machine drive.</p><div id="attachment_5669" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot6-Dynamic-Disk-Discovered.jpg?d9c344"><img class="size-large wp-image-5669" title="Dynamic disk discovered" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot6-Dynamic-Disk-Discovered-590x304.jpg?d9c344" alt="Dynamic disk discovered" width="590" height="304" /></a><p class="wp-caption-text">Figure 6: Dynamic disk discovered</p></div><div id="attachment_5670" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot7-iSCSI-Status.jpg?d9c344"><img class="size-large wp-image-5670" title="iSCSI status" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/Screenshot7-iSCSI-Status-590x351.jpg?d9c344" alt="iSCSI status" width="590" height="351" /></a><p class="wp-caption-text">Figure 7: iSCSI status</p></div><p>You can check open sessions in Openfiler by selecting Status &#8211;&gt; iSCSI targets (Figure 7).</p><p>In a nutshell, Openfiler provides an excellent iSCSI target, usable by various client operating systems as local storage. The <a href="http://www.openfiler.com/products">various deployment scenarios detailed on the Openfiler website</a> are:</p><table border="0"><thead><tr><td>Storage Area Networking</td><td>Network Attached Storage</td></tr></thead><tbody><tr><td><ul><li>IP Storage Gateway</li><li>Disk-to-disk Backup</li><li>Video Surveillance</li><li>Oracle 10g raw volume</li><li>Virtual Machine migration</li><li>Continuous Data Protection</li></ul></td><td><ul><li>Heterogeneous File Sharing</li><li>Exchange Server backend</li><li>Virtual Machine storage backend</li><li>Network User home directories</li><li>Media archiving</li></ul></td></tr></tbody></table><p>To sum up, Openfiler is a great file server, and supports various configurations including:</p><ul><li>Various access methods such as FTP, NFS, CIFS, HTTP/DAV, rsync, etc.</li><li>Network access controls.</li><li>Group- and user-based quota allocation.</li><li>Various RAID levels to improve data reliability.</li><li>Bonded interfaces to increase network throughput/Ethernet redundancy.</li><li>Intuitive Web interface for configuration.</li><li>Uses the full potential of 64-bit CPUs for excellent performance (the latest release is only for 64-bit CPUs).</li><li>Scalability to a capacity of more than 60 TB.</li><li>Last, but not the least, it is open source, with great community support.</li></ul><p>The latest stable release of Openfiler is 2.99; one of the most important additions is GUI-based configuration for High-Availability (HA) clusters. Keep a watch on this column for more articles on various Linux distros!</p><h5>References</h5><ul><li><a href="http://www.openfiler.com">Openfiler website</a></li><li><a href="http://www.openfiler.com/community/forums">Openfiler community forums</a></li><li><a href="http://sourceforge.net/projects/linux-iscsi/files/">Linux iSCSI initiator downloads</a></li></ul><div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 1</a></li><li><a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 2</a></li><li><a href="http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 3</a></li><li><a href="http://www.linuxforu.com/2011/06/lamp-server-in-10-minutes-turnkey/" rel="bookmark" class="crp_title">Turnkey: Build LAMP Server in Under 10 Minutes</a></li><li><a href="http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/" rel="bookmark" class="crp_title">Setting up a LAMP Server Remotely</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/ethernet/" title="Ethernet" rel="tag">Ethernet</a>, <a href="http://www.linuxforu.com/tag/ethernet-devices/" title="ethernet devices" rel="tag">ethernet devices</a>, <a href="http://www.linuxforu.com/tag/file-server/" title="file server" rel="tag">file server</a>, <a href="http://www.linuxforu.com/tag/file-sharing/" title="File Sharing" rel="tag">File Sharing</a>, <a href="http://www.linuxforu.com/tag/hard-disks/" title="hard disks" rel="tag">hard disks</a>, <a href="http://www.linuxforu.com/tag/httpdav/" title="HTTP/DAV" rel="tag">HTTP/DAV</a>, <a href="http://www.linuxforu.com/tag/individual-computer/" title="individual computer" rel="tag">individual computer</a>, <a href="http://www.linuxforu.com/tag/internet-engineering-task-force/" title="internet engineering task force" rel="tag">internet engineering task force</a>, <a href="http://www.linuxforu.com/tag/internet-small-computer-systems/" title="Internet Small Computer Systems" rel="tag">Internet Small Computer Systems</a>, <a href="http://www.linuxforu.com/tag/iscsi/" title="iSCSI" rel="tag">iSCSI</a>, <a href="http://www.linuxforu.com/tag/iscsi-initiator/" title="iscsi initiator" rel="tag">iscsi initiator</a>, <a href="http://www.linuxforu.com/tag/lfy-november-2011/" title="LFY November 2011" rel="tag">LFY November 2011</a>, <a href="http://www.linuxforu.com/tag/local-network/" title="local network" rel="tag">local network</a>, <a href="http://www.linuxforu.com/tag/network-interface/" title="network interface" rel="tag">network interface</a>, <a href="http://www.linuxforu.com/tag/network-transport-protocols/" title="network transport protocols" rel="tag">network transport protocols</a>, <a href="http://www.linuxforu.com/tag/raid/" title="RAID" rel="tag">RAID</a>, <a href="http://www.linuxforu.com/tag/scsi/" title="SCSI" rel="tag">SCSI</a>, <a href="http://www.linuxforu.com/tag/scsi-layer/" title="scsi layer" rel="tag">scsi layer</a>, <a href="http://www.linuxforu.com/tag/scsi-protocol/" title="scsi protocol" rel="tag">scsi protocol</a>, <a href="http://www.linuxforu.com/tag/scsi-standard/" title="scsi standard" rel="tag">scsi standard</a>, <a href="http://www.linuxforu.com/tag/speed-peripherals/" title="speed peripherals" rel="tag">speed peripherals</a>, <a href="http://www.linuxforu.com/tag/storage-device/" title="storage device" rel="tag">storage device</a>, <a href="http://www.linuxforu.com/tag/storage-management/" title="storage management" rel="tag">storage management</a>, <a href="http://www.linuxforu.com/tag/tcpip/" title="TCP/IP" rel="tag">TCP/IP</a>, <a href="http://www.linuxforu.com/tag/virtual-machine/" title="virtual machine" rel="tag">virtual machine</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Storage Management using Openfiler, Part 3</title><link>http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storage-management-using-openfiler-part-3</link> <comments>http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/#comments</comments> <pubDate>Fri, 30 Sep 2011 18:38:05 +0000</pubDate> <dc:creator>Rajesh Deodhar</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[data volumes]]></category> <category><![CDATA[disk druid]]></category> <category><![CDATA[DNS]]></category> <category><![CDATA[Ethernet]]></category> <category><![CDATA[firewall]]></category> <category><![CDATA[FTP]]></category> <category><![CDATA[FTP server]]></category> <category><![CDATA[grub]]></category> <category><![CDATA[http]]></category> <category><![CDATA[Internet traffic]]></category> <category><![CDATA[IP]]></category> <category><![CDATA[IPCop]]></category> <category><![CDATA[LFY October 2011]]></category> <category><![CDATA[Openfiler]]></category> <category><![CDATA[Openfiler administration]]></category> <category><![CDATA[port forwarding]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[raid 1]]></category> <category><![CDATA[SATA]]></category> <category><![CDATA[snmp]]></category> <category><![CDATA[software raid]]></category> <category><![CDATA[storage management]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5970</guid> <description><![CDATA[The first article of this series discussed basic installation and configuration; the second described some advanced Openfiler features including bonded interfaces and RAID 1 data storage, with some important setup instructions and troubleshooting...]]></description> <content:encoded><![CDATA[<p><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/11/openfiler-3.jpg?d9c344"><img class="alignright size-full wp-image-5971" title="It's time we file" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/openfiler-3.jpg?d9c344" alt="It's time we file" width="350" height="335" /></a><div class="introduction">The <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">first article</a> of this series discussed basic installation and configuration; <a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" title="Storage Management using Openfiler, Part 2">the second</a> described some advanced Openfiler features including bonded interfaces and RAID 1 data storage, with some important setup instructions and troubleshooting tips. This article covers two additional important aspects of Openfiler installation &#8212; RAID 1 for the Openfiler OS disk too, and an FTP server with a firewall port forwarding feature.</div><p>The <a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" title="Storage Management using Openfiler, Part 2">Openfiler RAID 1 setup that we discussed last month</a> uses mirroring for data volumes, and a single additional OS hard disk. Here, to recover from a crashed OS disk, one must replace the disk, reinstall the OS and restore backups. The RAID data volumes remaining intact, the server is back in action after that. Disadvantages here are the need for an additional OS disk (and its power consumption) and having to reinstall the OS to recover. It is also possible to have both OS partitions and RAID 1 volumes on just two disks, in two steps:</p><ol><li>Create required OS partitions, configure them in RAID 1, modify GRUB to include the second hard disk as a bootable disk.</li><li>Create RAID 1 volumes, and assign user rights from the Web-based Openfiler GUI.</li></ol><p>Hardware configuration used was an Intel Dual-Core CPU-based PC with 2 GB RAM, 2&#215;500 GB SATA hard disks, and a DVD drive for installation. Openfiler version 2.3 was used.</p><p>Start by booting from the Openfiler CD, and continue with GUI-based installation. The most important step required for RAID 1 installation is creating the RAID partitions manually using Disk Druid. Check the following table for the brief layout.</p><table border="0"><thead><tr><td>Partition Name</td><td>Type</td><td>Create in</td><td>Size in MB</td><td>Create and mount software RAID 1 array</td><td>RAID 1 Array Members</td><td>Purpose</td></tr></thead><tbody><tr><td>Boot</td><td>Software RAID</td><td>hda &amp; hdb</td><td>256</td><td>md0, mount as /boot</td><td>hda1 &amp; hdb1</td><td>kernel</td></tr><tr><td>Root</td><td>Software RAID</td><td>hda &amp; hdb</td><td>2048</td><td>md1 mount as /</td><td>hda2 &amp; hdb2</td><td>Apps &amp; libraries</td></tr><tr><td>Log</td><td>Software RAID</td><td>hda &amp; hdb</td><td>768</td><td>md2 mount as /var/log</td><td>hda3 &amp; hdb3</td><td>Logs</td></tr><tr><td>Swap</td><td>Swap</td><td>hda &amp; hdb</td><td>512</td><td>N/A</td><td>N/A</td><td>Swap space</td></tr></tbody></table><div id="attachment_5973" class="wp-caption aligncenter" style="width: 300px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/1-RAID-Partitions.jpg?d9c344"><img class="size-full wp-image-5973" title="Creating RAID partitions" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/1-RAID-Partitions.jpg?d9c344" alt="Creating RAID partitions" width="300" height="257" /></a><p class="wp-caption-text">Figure 1: Creating RAID partitions</p></div><div id="attachment_5974" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/2-Verifying-RAID1-partitions.jpg?d9c344"><img class="size-large wp-image-5974" title="Verifying RAID 1 partitions" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/2-Verifying-RAID1-partitions-590x413.jpg?d9c344" alt="Verifying RAID 1 partitions" width="590" height="413" /></a><p class="wp-caption-text">Figure 2: Verifying RAID 1 partitions</p></div><p>The remaining installation options are straightforward &#8212; Ethernet interface parameters (don&#8217;t forget to set the interface to activate at boot); setting timezone and assigning a root password. Once done, open the Web GUI from any computer (<code>https://ipaddress:446</code>). Verify the <em>RAID configuration &#8211;&gt; navigate to Volumes &#8211;&gt; Software RAID</em> and verify all the three RAID volumes created earlier. If any change is required, now is the time to fix the partitions.</p><p>Next, log in as root and update Openfiler with the following commands:</p><pre class="brush: shell; gutter: false;">conary updateall
conary update conary</pre><p>Confirm that all updates have been applied, by running the same command till you receive the message: &#8220;no new troves were found&#8221;.</p><p>One important step remains. The Openfiler setup has only the GRUB register hda as a boot drive; hdb should also be made bootable. To do this, use the following commands (apply GRUB commands corresponding to the detected hard disks; here, hda was detected as sda and hdb as sdb):</p><pre class="brush: shell; gutter: false;">root@localhost:~# grub
grub&gt; device (hd0) /dev/sda
grub&gt; root (hd0,0)
grub&gt; setup (hd0)
grub&gt; device (hd1) /dev/sdb
grub&gt; root (hd1,0)
grub&gt; setup (hd1)
grub&gt; quit
root@localhost:~#</pre><p>Figure 3 lists the terminal output for the above commands.</p><div id="attachment_5975" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/3-Grub-Commands.jpg?d9c344"><img class="size-large wp-image-5975" title="Grub commands" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/3-Grub-Commands-590x422.jpg?d9c344" alt="Grub commands" width="590" height="422" /></a><p class="wp-caption-text">Figure 3: Grub commands</p></div><h2>Verifying the installation</h2><p>You can remove one hard disk at a time, and check whether the system boots properly. Once up and running using a single disk, check under <em>Volumes &#8211;&gt; Software RAID</em>; you will see the &#8220;clean&#8221; and &#8220;degraded&#8221; volumes (which remain unsynchronised), as shown in Figure 4.</p><div id="attachment_5976" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/4-sda-removed-from-RAID1-Array.jpg?d9c344"><img class="size-large wp-image-5976" title="sda removed from RAID1 Array" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/4-sda-removed-from-RAID1-Array-590x354.jpg?d9c344" alt="sda removed from RAID1 Array" width="590" height="354" /></a><p class="wp-caption-text">Figure 4: sda removed from RAID1 Array</p></div><p>After re-installing the removed disk, proceed to add the member to the RAID 1 array, for synchronisation to start. Then select <em>Add Member</em> from the <em>ADD</em> column; carefully check the partition sizes, and add the required RAID 1 member to the array. You can see the synchronisation process status (Figure 5) immediately after this. If a new hard disk is added, you will require to create the partitions and then add them to the RAID array.</p><div id="attachment_5977" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/5-RAID-Synchronization.jpg?d9c344"><img class="size-large wp-image-5977" title="RAID synchronization" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/5-RAID-Synchronization-590x354.jpg?d9c344" alt="RAID synchronization" width="590" height="354" /></a><p class="wp-caption-text">Figure 5: RAID synchronization</p></div><p>The remaining setup requires you to configure network access <em>via System &#8211;&gt; Network Setup</em>; create the Network Access Configuration to allow access to the full subnet.</p><h2>Important tips</h2><ol><li>Use only manual partitioning. Auto partitioning will use the full disk for the OS, leaving no space for data storage.</li><li>Make all software RAID partitions primary partitions &#8212; check the &#8220;Force primary&#8221; checkbox.</li><li>By default, logs are stored on the root (<code>/</code>) partition. If it runs out of space, the system stops functioning. To protect against this, a separate <code>/var/log</code> partition is recommended.</li><li>Do not configure swap partitions as either RAID type, or primary partitions.</li><li>You must configure GRUB to allow booting from both disks &#8212; else, if hda fails, the system will not boot &#8212; and OS redundancy by RAID 1 will be useless.</li><li>Further configuration steps, with screenshots, are given in the <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">August</a> and <a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" title="Storage Management using Openfiler, Part 2">September</a> articles. Refer to those for more information.</li></ol><h2>Enabling FTP</h2><p>In the Web GUI, create a user group: <em>Accounts &#8211;&gt; Administration &#8211;&gt; Group Administration</em>; create <code>ftpgroup</code>, overriding GID to 1001. Then create the <code>ftpuser1</code> user in <em>Accounts –-&gt; Administration &#8211;&gt; User Administration</em>, overriding UID to 501. Go to <em>Services &#8211;&gt; FTP Server</em> and click <em>Enable</em>.</p><p>After you add volumes to your volume group and create an ext3 partition (of 150 GB, for instance), use <em>Make share as FTP</em> and configure <code>ftpgroup</code> as the primary group (PG); allocate read-write (RW) access to <code>ftpgroup</code>. Under the host access configuration, select RW access for FTP to the Internal PCs group. Now, you can access the FTP share with standard FTP clients from your internal network.</p><h2>Accessing the FTP server from the Internet</h2><p>To access this server from the Internet, you require to set up a small network with a firewall capable of port forwarding. IPCop is an excellent GNU firewall distribution for this purpose. Internal PCs/servers access the Internet via the firewall, which passes requests from internal PCs, to the requested Internet address, and passes replies back to the originating internal PCs. To allow external computers to access internal servers, we use a firewall feature called port forwarding. For more information, see <a href="http://en.wikipedia.org/wiki/Port_forwarding">Wikipedia on port forwarding</a>.</p><p>Basically, connections to the firewall at certain port numbers used for different services can be passed on to servers behind the firewall, and the servers&#8217; responses relayed back to the computer on the Internet that requested the service. Some well-known ports are TCP 20, 21 for FTP data and FTP; TCP and UDP 53 for DNS; TCP 80 and 443 for HTTP/HTTPS; and UDP 161 for SNMP.</p><p>Prudent firewall installations first block all incoming Internet traffic to the internal network, and vice versa. Then, depending on the requirements, access is allowed for the requested services.</p><h2>Configuring IPCop for port forwarding</h2><p>Internet traffic to TCP ports 20 and 21 on the public Internet interface must be forwarded to the internal FTP (Openfiler) server. Port forwarding configuration instructions will differ depending on firewall type. Figure 6 shows IPCop&#8217;s port forwarding screen. Access can be restricted to a particular source IP address/range of IP addresses by entering the corresponding IP or network address in the Source IP field, as you can see in Figure 6. The ports are forwarded to the internal FTP server only if the originating IP address is the configured source IP.</p><div id="attachment_5980" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/10/8-IPCop-Port-Forward.jpg?d9c344"><img class="size-large wp-image-5980" title="IPCop port forward" src="http://cdn.linuxforu.com/wp-content/uploads/2011/10/8-IPCop-Port-Forward-590x327.jpg?d9c344" alt="IPCop port forward" width="590" height="327" /></a><p class="wp-caption-text">Figure 6: IPCop port forward</p></div><p>That is all, folks! Now, the internal Openfiler FTP server can be accessed from preconfigured public IP addresses with any standard FTP client software such as Filezilla or CoreFTP.</p><p>Once installation is complete, don&#8217;t forget to back up your system and LDAP configuration via <em>System–Backup/Restore &#8211;&gt; Download and Services &#8211;&gt; LDAP setup &#8211;&gt; Backup LDAP</em>.</p><p>For several important installation details, please refer to the <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">August</a> and <a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" title="Storage Management using Openfiler, Part 2">September</a> articles.</p><div class="note"><strong>Real-life scenario:</strong> An IT-enabled Services (ITeS) company daily received a lot of data from a client for processing. For this, the company had rented a huge space on an FTP server. The regular practice was that the client uploaded data on the FTP server, which the company downloaded to work on. After completing the work, the data was again uploaded on the FTP server for the client to download. Depending on data size, the upload and download took two to four hours on a 2 MBps leased line.</p><p>After installing an Openfiler FTP server with firewall port forwarding, the customer now uploads data directly to Openfiler, which is locally available to the company. Processed data goes back on the Openfiler server. This has saved the company rental costs of the FTP server, and most importantly, valuable upload/download time.</p></div><div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 2</a></li><li><a href="http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 4</a></li><li><a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 1</a></li><li><a href="http://www.linuxforu.com/2011/12/ipcop-firewall-installation-basics/" rel="bookmark" class="crp_title">Guard Your Network with IPCop, Part 1: Installation Basics</a></li><li><a href="http://www.linuxforu.com/2011/06/lamp-server-in-10-minutes-turnkey/" rel="bookmark" class="crp_title">Turnkey: Build LAMP Server in Under 10 Minutes</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/data-volumes/" title="data volumes" rel="tag">data volumes</a>, <a href="http://www.linuxforu.com/tag/disk-druid/" title="disk druid" rel="tag">disk druid</a>, <a href="http://www.linuxforu.com/tag/dns/" title="DNS" rel="tag">DNS</a>, <a href="http://www.linuxforu.com/tag/ethernet/" title="Ethernet" rel="tag">Ethernet</a>, <a href="http://www.linuxforu.com/tag/firewall/" title="firewall" rel="tag">firewall</a>, <a href="http://www.linuxforu.com/tag/ftp/" title="FTP" rel="tag">FTP</a>, <a href="http://www.linuxforu.com/tag/ftp-server/" title="FTP server" rel="tag">FTP server</a>, <a href="http://www.linuxforu.com/tag/grub/" title="grub" rel="tag">grub</a>, <a href="http://www.linuxforu.com/tag/http/" title="http" rel="tag">http</a>, <a href="http://www.linuxforu.com/tag/internet-traffic/" title="Internet traffic" rel="tag">Internet traffic</a>, <a href="http://www.linuxforu.com/tag/ip/" title="IP" rel="tag">IP</a>, <a href="http://www.linuxforu.com/tag/ipcop/" title="IPCop" rel="tag">IPCop</a>, <a href="http://www.linuxforu.com/tag/lfy-october-2011/" title="LFY October 2011" rel="tag">LFY October 2011</a>, <a href="http://www.linuxforu.com/tag/openfiler/" title="Openfiler" rel="tag">Openfiler</a>, <a href="http://www.linuxforu.com/tag/openfiler-administration/" title="Openfiler administration" rel="tag">Openfiler administration</a>, <a href="http://www.linuxforu.com/tag/port-forwarding/" title="port forwarding" rel="tag">port forwarding</a>, <a href="http://www.linuxforu.com/tag/raid/" title="RAID" rel="tag">RAID</a>, <a href="http://www.linuxforu.com/tag/raid-1/" title="raid 1" rel="tag">raid 1</a>, <a href="http://www.linuxforu.com/tag/sata/" title="SATA" rel="tag">SATA</a>, <a href="http://www.linuxforu.com/tag/snmp/" title="snmp" rel="tag">snmp</a>, <a href="http://www.linuxforu.com/tag/software-raid/" title="software raid" rel="tag">software raid</a>, <a href="http://www.linuxforu.com/tag/storage-management/" title="storage management" rel="tag">storage management</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Comprehensive LAMP Guide &#8212; Part 3 (PHP)</title><link>http://www.linuxforu.com/2011/09/comprehensive-lamp-guide-part-3-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comprehensive-lamp-guide-part-3-php</link> <comments>http://www.linuxforu.com/2011/09/comprehensive-lamp-guide-part-3-php/#comments</comments> <pubDate>Wed, 31 Aug 2011 18:43:00 +0000</pubDate> <dc:creator>Nilesh Govindarajan</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[APC]]></category> <category><![CDATA[bison]]></category> <category><![CDATA[cflags]]></category> <category><![CDATA[CGI]]></category> <category><![CDATA[configure script]]></category> <category><![CDATA[Facebook]]></category> <category><![CDATA[FastCGI]]></category> <category><![CDATA[GCC]]></category> <category><![CDATA[gnu autoconf]]></category> <category><![CDATA[html]]></category> <category><![CDATA[hypertext preprocessor]]></category> <category><![CDATA[LAMP]]></category> <category><![CDATA[LFY September 2011]]></category> <category><![CDATA[maximum performance]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[opcode cache]]></category> <category><![CDATA[OpenSSL library]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[PHP FPM]]></category> <category><![CDATA[php source]]></category> <category><![CDATA[source tarball]]></category> <category><![CDATA[W3C]]></category> <category><![CDATA[web applications]]></category> <category><![CDATA[Web apps]]></category> <category><![CDATA[Web server]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5415</guid> <description><![CDATA[PHP, the &#8220;P&#8221; in LAMP, is a recursive acronym for PHP: Hypertext Preprocessor. It is the most widely used programming language for Web applications because of its ease of learning, implementation and wide...]]></description> <content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-6269" title="PHP: Hypertext Preprocessor" src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/lamp-php-guide-590x320.jpg?d9c344" alt="PHP: Hypertext Preprocessor" width="590" height="320" /></p><div class="introduction">PHP, the &#8220;P&#8221; in LAMP, is a recursive acronym for PHP: Hypertext Preprocessor. It is the most widely used programming language for Web applications because of its ease of learning, implementation and wide range of server support. This guide aims to help you set up PHP on Apache for maximum performance.</div><p>PHP installation is similar to Apache&#8217;s installation process, with GNU <code>autoconf</code> involved (<code>./configure</code> script). We&#8217;ve already discussed setting up the optimisation flags for Apache (<code>CFLAGS</code>, <code>CXXFLAGS</code>) and hence I won&#8217;t describe the process here &#8212; please read the <a href="http://www.linuxforu.com/XXXXXX/" class="broken_link">earlier article in this series from June 2011</a> for that. To install PHP 5.3.6 (the latest available, as of this writing), you need (these requirements have been taken from the <code>INSTALL</code> file in the tarball):</p><ul><li>ANSI C Compiler (GCC on Linux)</li><li>Flex 2.5.4</li><li>Bison 1.28, 1.35 or 1.75</li><li>Web server</li><li>Module specific components (gd, pdf libs, etc)</li></ul><p>The PHP source configuration is a bit tricky; extensions enabled by default (or by specifying an option) are compiled statically. You need to take special care about this. Statically compiling extensions means the extension will be embedded into the PHP binary itself; you cannot disable it at will. If you can&#8217;t disable the extension, it causes memory wastage if you aren&#8217;t using the extension in any of your applications on the server.</p><p>Telling the PHP build system to build all extensions takes effort. You have to state &#8220;shared&#8221; in the extension enabler switch: <code>--with-EXT=shared</code> or <code>--enable-EXT=shared</code>. There are two switches, <code>--enable-shared</code> and <code>--disable-static</code> that can be passed to <code>./configure</code>, but they never worked for me &#8212; the build system always compiled extensions statically.</p><p>Get the PHP source tarball from its <a href="http://www.php.net/downloads.php">official website</a>, and also note the MD5 sum shown on the download page, for file verification (similar to what we did when <a href="http://www.linuxforu.com/XXXXXX/" class="broken_link">installing MySQL, in July</a>). Do not skip file verification; often, a proper tarball wasn&#8217;t downloaded and my installation had problems like memory leaks, etc.</p><p>Extract the archive to get the <code>php-5.3.6</code> subdirectory. Before we begin configuring the source, if you want to install some PECL extensions directly with PHP (if you choose not to install PEAR/PECL with PHP), then you must place them in the <code>ext</code> directory, and subsequently run the <code>autoconf</code> tool present in the source code folder itself, with <code>./autoconf</code>).</p><h2>Configuring and building PHP</h2><p>So here&#8217;s the table of options that the PHP <code>./configure</code> accepts, and a short description of what they do. This list isn&#8217;t exhaustive; run <code>./configure --help | less</code> to get a full list. Please note that you have to set the hardware-dependent <code>CFLAGS</code>, <code>CXXFLAGS</code> for optimisation.</p><p>Another thing to remember is that if an option&#8217;s <em>disable</em> version is shown in the exhaustive list, then its enable counterpart also exists and can be used. For example, <code>--disable-libxml</code> is listed, but not <code>--enable-libxml</code> &#8212; yet it can be used.</p><table border="0"><thead><tr><td>Option</td><td>Description</td></tr></thead><tbody><tr><td><code>cache-file=FILE</code></td><td>Enables creation of <code>./configure</code> cache; <code>FILE</code> is usually <code>config.cache</code>. This improves configuration speed if the configuration process is broken due to the absence of some library, etc.</td></tr><tr><td><code>--prefix=PREFIX</code></td><td>Directory prefix where PHP should be installed, defaults to <code>/usr/local</code>; PHP binaries go in <code>&lt;PREFIX&gt;/bin</code></td></tr><tr><td><code>--with-apxs2=FILE</code></td><td>Builds the Apache module <code>libphp5.so</code>. <code>FILE</code> is the path to the <code>apxs</code> tool (this is optional; specify only when <code>configure</code> fails to find <code>apxs</code> in <code>$PATH</code>.</td></tr><tr><td><code>--disable-cli</code></td><td>Disables the command-line version of PHP and forces <code>-–without-pear</code>.</td></tr><tr><td><code>--enable-fpm</code></td><td>Enables building of FPM SAPI executable.</td></tr><tr><td><code>--disable-cgi</code></td><td>Disables CGI version of PHP; use if you won&#8217;t be using CGI (for FastCGI, we have FPM).</td></tr><tr><td><code>--with-config-file-path=PREFIX/lib</code></td><td>Where the PHP interpreter should look for <code>php.ini</code>. I got confused with this &#8212; it&#8217;s the path to the directory where <code>php.ini</code> will be, not including the filename! For example: <code>--with-config-file-path=/usr/local/etc</code>.</td></tr><tr><td><code>--with-config-file-scan-dir=PATH</code></td><td>Indicates which directory PHP scans to load additional configuration files. Helps clean up <code>php.ini</code> (separating it into different files). Also, if you install extensions, you don&#8217;t have to add their configuration to <code>php.ini</code>; you can add separate configuration files to the scan directory. I use <code>--with-config-file-scan-dir=/usr/local/etc/php.d</code></td></tr><tr><td><code>--enable/disable-libxml</code></td><td>Enables/disables <code>libxml</code>; it is enabled by default. You shouldn&#8217;t disable this unless you have a special reason to do so, because many extensions depend on this.</td></tr><tr><td><code>--with-openssl[=shared[,DIR]]</code></td><td>Compile PHP with OpenSSL support. You can link the SSL extension with the OpenSSL library found in <code>/usr/include</code>, or a special version whose path you can provide as a parameter. If you want to build the extension as a dynamic library then: <code>--with-openssl=shared</code></td></tr><tr><td><code>--with-zlib[=shared[,DIR]]</code></td><td>Enables <code>zlib</code> extension (responsible for gzip compression, etc.) Requires <code>zlib &gt;= 1.0.9</code>.</td></tr><tr><td><code>--enable-bcmath[=shared]</code></td><td>Enables the <code>bcmath</code> extension, many packages use this.</td></tr><tr><td><code>--with-bz2[=shared[,DIR]]</code></td><td>Enables the bzip2 extension.</td></tr><tr><td><code>--enable-calendar[=shared]</code></td><td>Enables support for calendar conversion, some packages may require this.</td></tr><tr><td><code>--with-curl[=shared[,DIR]]</code></td><td>Enables the cURL extension. Requires the library be installed; many Web apps require this.</td></tr><tr><td><code>--enable-exif[=shared]</code></td><td>Enables the EXIF extension. A good idea if you have image-processing applications.</td></tr><tr><td><code>--enable-ftp[=shared]</code></td><td>Enables the FTP extension. There&#8217;s no reason to enable this unless you are installing a PHP FTP client or want PHP scripts to connect to FTP servers.</td></tr><tr><td><code>--with-gd[=shared[,DIR]]</code></td><td>Enables GD support. Image-processing packages require this. GD is bundled with the source tarball, but you may configure the extension to use the system version of the <code>gd</code> library.</td></tr><tr><td><code>--with-jpeg-dir[=DIR]</code></td><td>Enables JPEG handling in GD. Requires <code>libjpeg</code> to be installed.</td></tr><tr><td><code>--with-png-dir[=DIR]</code></td><td>Enables PNG support in GD; needs <code>libpng</code> installed.</td></tr><tr><td><code>--with-xpm-dir[=DIR]</code></td><td>Enables XPM support in GD, needs <code>libXpm</code> installed.</td></tr><tr><td><code>--with-freetype-dir[=DIR]</code></td><td>Enables FreeType support in GD. FreeType is used by many packages, especially those that generate CAPTCHAs, etc.</td></tr><tr><td><code>--with-t1lib[=DIR]</code></td><td>Enables <code>T1lib</code> support, which is required by some packages, in GD.</td></tr><tr><td><code>--with-gettext[=shared[,DIR]]</code></td><td>Enables <code>gettext</code> support, used for internationalisation and localisation of programs. Some packages may require this.</td></tr><tr><td><code>--with-gmp[=shared,[,DIR]]</code></td><td>Enables GNU Math Processing library. This is similar to the BCMath extension. Most packages ask you to install either, but enabling both is better for sanity.</td></tr><tr><td><code>--with-mhash[=shared,[,DIR]]</code></td><td>Enables support for <code>libmhash</code>, which supports hash algorithms including common ones like MD5, SHA1, etc.</td></tr><tr><td><code>--enable-intl</code></td><td>Enables internationalisation support.</td></tr><tr><td><code>--enable-json[=shared]</code></td><td>JSON support is enabled by default; this option is not shown in the exhaustive list &#8212; yet it can be built as a shared extension.</td></tr><tr><td><code>--enable-mbstring[=shared]</code></td><td>Enables multi-byte string support, required for multilingual websites.</td></tr><tr><td><code>--with-mcrypt[=shared[,DIR]]</code></td><td>The <code>mcrypt</code> encryption library supports a lot of encryption algorithms.</td></tr><tr><td><code>--with-mysql[=shared,[,DIR]]</code></td><td>Enables MySQL support. DIR can be the path to the source files of the <code>mysql</code> library or <code>mysqlnd</code>; in the latter case, the native driver bundled in the source will be used. Defaults to <code>/usr/local</code>.</td></tr><tr><td><code>--with-mysql-sock[=DIR]</code></td><td>Sets the default location of the MySQL socket used by MySQL connect functions. If <code>DIR</code> is not specified, default locations are searched.</td></tr><tr><td><code>--with-mysqli[=shared[,FILE]]</code></td><td>Enables MySQLi support; this is an improved version of the MySQL extension with OOP interface. <code>FILE</code> is <code>mysqlnd</code> or path to <code>mysql_config</code> binary.</td></tr><tr><td><code>--enable-embedded-mysqli</code></td><td>Enables embedded MySQL server support for MySQLi; it doesn&#8217;t work with <code>mysqlnd</code>.</td></tr><tr><td><code>--enable-pcntl[=shared]</code></td><td>Enables PCNTL (Process Control) extension, which is rarely required. This is enabled only for CLI and CGI (and FastCGI).</td></tr><tr><td><code>--enable-pdo[=shared]</code></td><td>PDO support is enabled by default, which is not shown in the exhaustive list.</td></tr><tr><td><code>--with-pdo-mysql[=shared[,DIR]]</code></td><td>Enables MySQL for PDO; <code>DIR</code> is <code>mysqlnd</code> or path to MySQL library.</td></tr><tr><td><code>--with-pdo-sqlite[=shared,DIR]]</code></td><td>SQLite 3 support for PDO, which is enabled by default; option not shown in exhaustive list. <code>DIR</code> is path to <code>sqlite3</code> library which includes files.</td></tr><tr><td><code>--with-pspell[=shared[,DIR]]</code></td><td>Enables ASPELL spell-checker support; some Web applications use this. Needs GNU Aspell &gt;= 0.5.0 installed on the system.</td></tr><tr><td><code>--enable-session[=shared]</code></td><td>Session support, which is enabled by default; option not shown in exhaustive list. There&#8217;s no reason to build this extension as a shared library unless you have a special reason to do so.</td></tr><tr><td><code>--enable-shmop[=shared]</code></td><td>Enables SHM (shared memory) operation support.</td></tr><tr><td><code>--enable-simplexml[=shared]</code></td><td>Enabled by default; though not shown in exhaustive list.</td></tr><tr><td><code>--enable-soap[=shared]</code></td><td>Enables SOAP support, which some applications may need.</td></tr><tr><td><code>--with-sqlite[=shared[,DIR]]</code></td><td>SQLite 2 support, which is enabled by default, but not shown in exhaustive list.</td></tr><tr><td><code>--enable-sqlite-utf8</code></td><td>Enables UTF-8 support for SQLite 2</td></tr><tr><td><code>--with-sqlite3[=shared]</code></td><td>SQLite 3 support, which is enabled by default but not shown in exhaustive list.</td></tr><tr><td><code>--with-tidy[=shared]</code></td><td>The Tidy extension can clean up HTML markup to conform to W3C standards. You need <code>tidy</code> installed.</td></tr><tr><td><code>--with-xmlrpc[=shared[,DIR]]</code></td><td>XMLRPC-EPI support; some applications may use it, like blogs and CMSs.</td></tr><tr><td><code>--enable-xmlreader[=shared]</code></td><td>XMLReader support, which is enabled by default and is not shown in exhaustive list.</td></tr><tr><td><code>--enable-xmlwriter[=shared]</code></td><td>XMLWriter support, enabled by default but not shown in exhaustive list.</td></tr><tr><td><code>--enable-zip[=shared]</code></td><td>Enables ZIP-file handling extension.</td></tr><tr><td><code>--with-pear=DIR</code></td><td>Installs PEAR in <code>DIR</code>; <code>DIR</code> defaults to <code>PREFIX/lib/php</code>.</td></tr></tbody></table><p>After you have completed configuration with <code>./configure</code> and the options, run <code>make</code> and <code>make install</code> to install PHP, keeping your fingers crossed that it builds and installs successfully.</p><h2>PHP configuration</h2><p>Two configuration file candidates for <code>php.ini</code> are provided in the root of the source tarball: <code>php.ini-production</code> and <code>php.ini-development</code>. Unless you will be testing and developing on this system, choose the production version.</p><p>Copy <code>php.ini-production</code> to <code>/usr/local/etc/php.ini</code> or your <code>/php.ini</code> and start modifying it with your favourite text editor. Here is a table of options that can be specified in <code>php.ini</code>, along with a description of each:</p><table border="0"><thead><tr><td>Option</td><td>Description</td></tr></thead><tbody><tr><td><code>short_open_tag=&lt;On|Off&gt;</code></td><td>The short open tag <code>&lt;?</code> instead of <code>&lt;?php</code>.<br /> If you run old applications, enable this; this may cause confusion if other language processors like XML, etc, are present.</td></tr><tr><td><code>output_buffering=&lt;Off|Integer|On&gt;</code></td><td>Maximum output data buffer size before sending to client. <code>On</code> enables infinite buffer size (dangerous!). Best value: 4096.</td></tr><tr><td><code>zlib.output_compression=&lt;Off|On&gt;</code></td><td>Enables/disables gzip compression of output.</td></tr><tr><td><code>max_execution_time=&lt;Integer&gt;</code></td><td>Maximum script execution time (in seconds), set to 0 for CLI. Should be set after trial and error, though 30-60 seconds should be good for standard applications. A very large value is dangerous; a script can hog resources for a long time.</td></tr><tr><td><code>max_input_time=&lt;Integer&gt;</code></td><td>Maximum time a script can spend parsing request data. Default is unlimited (-1) [hard-coded for CLI].</td></tr><tr><td><code>memory_limit=&lt;size&gt;</code></td><td>Maximum memory a script may consume; size defaults to bytes, but modifiers like <code>M</code>, <code>G</code> can be applied, like <code>128 M</code>. Keep it so that malicious scripts don&#8217;t hog all available memory. 128-256 M is sufficient.</td></tr><tr><td><code>error_reporting</code></td><td>Sets the type of errors reported to <code>stdout</code>, <code>stderr</code> or the error log. Default value: <code>E_ALL &amp; ~E_NOTICE</code>. Production value: <code>E_ALL &amp; ~E_DEPRECATED</code>. Development value: <code>E_ALL | ~E_STRICT</code></td></tr><tr><td><code>display_errors=&lt;Off|On|stderr&gt;</code></td><td>Displays errors to <code>stdout</code> or <code>stderr</code>. <code>Stderr</code> affects only CLI and CGI binaries.</td></tr><tr><td><code>include_path=&lt;paths separated by colon&gt;</code></td><td>Colon-separated paths for PHP to search for files named in <code>include</code>, <code>require</code>, <code>include_once</code> or <code>require_once</code>.</td></tr><tr><td><code>file_uploads = &lt;Off|On&gt;</code></td><td>Enables/disables file uploads.</td></tr><tr><td><code>upload_max_filesize=&lt;size&gt;</code></td><td>Maximum file-size for file upload; takes modifiers like <code>M</code>, <code>G</code>, etc.</td></tr><tr><td><code>max_file_uploads=&lt;Integer&gt;</code></td><td>Maximum number of files that can be uploaded in a single request.</td></tr><tr><td><code>allow_url_include=&lt;Off|On&gt;</code></td><td>Inclusion of PHP files from URLs. This can pose a security threat; malicious files can be included from remote servers.</td></tr><tr><td><code>extension_dir=&lt;path&gt;</code></td><td>Location to find PHP extensions.</td></tr><tr><td><code>extension=&lt;filename&gt;</code></td><td>Tells PHP to load the extension named. <code>filename</code> takes full path to the extension, else it will be sought in <code>extension_dir</code>.</td></tr></tbody></table><p>In addition to this configuration, to get maximum performance, you should install an opcode cache like APC, XCache, eAccelerator, etc. Remember, PHP is an interpreted language; source is compiled every time the script is run. Caching compiled code saves CPU cycles.</p><p>You can also use Facebook&#8217;s Hiphop to convert PHP code to C++, which will help you boost performance immensely &#8212; but that is beyond the scope of this article.</p><h2>Configuring PHP with Apache</h2><p>There are three methods to configure PHP on Apache: CGI (the worst option), <code>mod_php</code> (better), and <code>mod_fastcgi</code> (the best). I&#8217;ll discuss only <code>mod_php</code> and <code>mod_fastcgi</code> methods.</p><h3>The mod_php method</h3><p>This is the most commonly used method to configure PHP with Apache. It is applicable only if you built the Apache SAPI for PHP (<code>--with-apxs2</code>). Add these lines to <code>httpd.conf</code> to enable PHP support with <code>mod_php</code>:</p><pre class="brush: text; gutter: false;">LoadModule php_module modules/libphp5.so
AddHandler php5-script .php
AddType text/html .php</pre><p>If you have read the PHP documentation for installation, then you might know that PHP recommends the use of <code>application/x-httpd-php</code> for PHP scripts &#8212; but that never worked properly for me; hence, I won&#8217;t advise it.</p><h3>The mod_fastcgi method</h3><p>With PHP-FPM, FastCGI usage has been increasing ever since, because of its advantages over CGI and <code>mod_php</code>. FastCGI&#8217;s advantage over others is that the PHP processing stack is separated from the server &#8212; there are some processes running separately, independent of the Web server on the machine where PHP is being used itself, or some remote destination. Because of this, opcode caches are able to share data across multiple processes, and their data is not destroyed when you change the Web server configuration and restart (or reload) it. Also, you can have dedicated PHP processing machines on the network to enable load sharing &#8212; very useful if you have a heavily trafficked site.</p><p>Again, there are two methods to use PHP with <code>mod_fastcgi</code>; the older uses <code>spawn-fcgi</code> or something similar, which sets up a PHP interpreter stack on a TCP port or a UNIX socket. The newer method uses PHP-FPM. <code>mod_fastcgi</code> is not provided with the default Apache installation &#8212; you have to <a href="http://www.fastcgi.com/">download</a> and install as per the <code>INSTALL</code> file in the tarball. Sometimes, the module is not automatically installed to the Apache modules directory; you need to copy it there from <code>/.libs/</code>. After you have installed the module, to enable it in Apache, add (or uncomment) this directive:</p><pre class="brush: text; gutter: false;">LoadModule fastcgi_module modules/mod_fastcgi.so</pre><h3>The older method using spawn-fcgi</h3><p>Run the following <code>spawn-fcgi</code> command (<code>spawn-fcgi</code> is a part of the <a href="http://www.lighttpd.net/">lighttpd</a> project, but is available as a separate package in many distributions):</p><pre class="brush: text; gutter: false;">spawn-fcgi -f /usr/local/bin/php-cgi -s /tmp/php.sock -u apache -g apache -C 10</pre><p>This will launch the PHP interpreter stack (consisting of 10 processes and one manager process) that will listen for requests at <code>/tmp/php.sock</code>. You can also make the stack listen on a TCP port using <code>-p</code> (port) and <code>-a</code> (address) option instead of <code>-s</code>. These are mutually exclusive.</p><p>Add these lines to the Apache configuration to enable PHP:</p><pre class="brush: text; gutter: false;">AddHandler php-fcgi .php
FastCgiExternalServer /var/www/cgi-bin/php.external -socket /tmp/php.sock -pass-header Authorisation
Action php-cgi /cgi-bin/php.external</pre><p>The above lines are the same if you use FPM &#8212; it is just that you may have to change the socket path if you specify a different path in FPM configuration.</p><p>You need to configure <code>FastCgiExternalServer</code>&#8216;s path into a <code>cgi-bin</code> directory, or you may have to set the <code>ExecCGI</code> option for PHP scripts if <code>php.external</code> is not in a <code>cgi-bin</code>. There are various ways to set up <code>php-fastcgi</code> on Apache, so use the one that works for you. Use Google to search for more information.</p><h2>FPM configuration</h2><p>A sample FPM configuration may be placed in <code>/usr/local/etc</code> or <code>&lt;PREFIX&gt;/etc</code>. The default location seems to be <code>/etc/php-fpm.conf</code> (as per my installation, on Gentoo), but that may differ across distributions. Look for the sample configuration in <code>/etc</code> and <code>/usr/local/etc</code> or <code>&lt;PREFIX&gt;/etc</code>; copy it to <code>php-fpm.conf</code> in the same directory, and start modifying it. The configuration file is well documented, so I&#8217;ll describe options specific to the PHP pool required to get PHP running, not the others.</p><p>A pool configuration section starts with the pool name in square brackets:</p><pre class="brush: text; gutter: false;">[www] ; Pool name = www</pre><p>To make a pool listen on a socket or TCP port, you need to use the listen option:</p><pre class="brush: text; gutter: false;">listen = &lt;path-to-socket|address:port&gt;</pre><p>Also note the options <code>listen.owner</code>, <code>listen.group</code> and <code>listen.mode</code>. If you make a mistake while configuring these, you may have a setup that doesn&#8217;t work. These should be configured so that the user and group Apache is running under should be able to read and write to the socket. The options <code>user</code> and <code>group</code> in the FPM configuration specify the user and group PHP runs as. This means that the user and group specified there should have read-write permissions to the directories/files they may be processing.</p><p>Other options you need to configure are <code>pm</code>, <code>pm.max_children</code>, <code>pm.start_servers</code>, <code>pm.min_spare_servers</code> and <code>pm.max_spare_servers</code>. The <code>pm=dynamic</code> setting is best &#8212; it will launch PHP processes when required (of course, <code>min_spare_servers</code> number of processes will always be running).</p><p>Other options depend on your server&#8217;s capacity. Read the documentation provided in the file itself to configure them.<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2009/03/joy-of-programming-how-to-detect-integer-overflow/" rel="bookmark" class="crp_title">Joy of Programming: How to Detect Integer Overflow</a></li><li><a href="http://www.linuxforu.com/2011/12/loading-library-files-in-cpp/" rel="bookmark" class="crp_title">Loading Library Files in C++</a></li><li><a href="http://www.linuxforu.com/2011/09/kernel-space-debuggers-in-linux/" rel="bookmark" class="crp_title">Device Drivers, Part 10: Kernel-Space Debuggers in Linux</a></li><li><a href="http://www.linuxforu.com/2009/01/joy-of-programming-some-puzzling-things-about-c/" rel="bookmark" class="crp_title">Joy of Programming: Some Puzzling Things About C Language!</a></li><li><a href="http://www.linuxforu.com/2009/03/crazy-commands/" rel="bookmark" class="crp_title">Crazy Commands</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/apache/" title="Apache" rel="tag">Apache</a>, <a href="http://www.linuxforu.com/tag/apc/" title="APC" rel="tag">APC</a>, <a href="http://www.linuxforu.com/tag/bison/" title="bison" rel="tag">bison</a>, <a href="http://www.linuxforu.com/tag/cflags/" title="cflags" rel="tag">cflags</a>, <a href="http://www.linuxforu.com/tag/cgi/" title="CGI" rel="tag">CGI</a>, <a href="http://www.linuxforu.com/tag/configure-script/" title="configure script" rel="tag">configure script</a>, <a href="http://www.linuxforu.com/tag/facebook/" title="Facebook" rel="tag">Facebook</a>, <a href="http://www.linuxforu.com/tag/fastcgi/" title="FastCGI" rel="tag">FastCGI</a>, <a href="http://www.linuxforu.com/tag/gcc/" title="GCC" rel="tag">GCC</a>, <a href="http://www.linuxforu.com/tag/gnu-autoconf/" title="gnu autoconf" rel="tag">gnu autoconf</a>, <a href="http://www.linuxforu.com/tag/html/" title="html" rel="tag">html</a>, <a href="http://www.linuxforu.com/tag/hypertext-preprocessor/" title="hypertext preprocessor" rel="tag">hypertext preprocessor</a>, <a href="http://www.linuxforu.com/tag/lamp/" title="LAMP" rel="tag">LAMP</a>, <a href="http://www.linuxforu.com/tag/lfy-september-2011/" title="LFY September 2011" rel="tag">LFY September 2011</a>, <a href="http://www.linuxforu.com/tag/maximum-performance/" title="maximum performance" rel="tag">maximum performance</a>, <a href="http://www.linuxforu.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.linuxforu.com/tag/opcode-cache/" title="opcode cache" rel="tag">opcode cache</a>, <a href="http://www.linuxforu.com/tag/openssl-library/" title="OpenSSL library" rel="tag">OpenSSL library</a>, <a href="http://www.linuxforu.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.linuxforu.com/tag/php-fpm/" title="PHP FPM" rel="tag">PHP FPM</a>, <a href="http://www.linuxforu.com/tag/php-source/" title="php source" rel="tag">php source</a>, <a href="http://www.linuxforu.com/tag/source-tarball/" title="source tarball" rel="tag">source tarball</a>, <a href="http://www.linuxforu.com/tag/w3c/" title="W3C" rel="tag">W3C</a>, <a href="http://www.linuxforu.com/tag/web-applications/" title="web applications" rel="tag">web applications</a>, <a href="http://www.linuxforu.com/tag/web-apps/" title="Web apps" rel="tag">Web apps</a>, <a href="http://www.linuxforu.com/tag/web-server/" title="Web server" rel="tag">Web server</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/09/comprehensive-lamp-guide-part-3-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Storage Management using Openfiler, Part 2</title><link>http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storage-management-using-openfiler-part-2</link> <comments>http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/#comments</comments> <pubDate>Wed, 31 Aug 2011 18:38:31 +0000</pubDate> <dc:creator>Rajesh Deodhar</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[Ethernet]]></category> <category><![CDATA[Ethernet cards]]></category> <category><![CDATA[Fast Ethernet]]></category> <category><![CDATA[Hard disk drive]]></category> <category><![CDATA[hard disks]]></category> <category><![CDATA[IP address]]></category> <category><![CDATA[LFY September 2011]]></category> <category><![CDATA[load-balancing]]></category> <category><![CDATA[Openfiler]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[raid 0]]></category> <category><![CDATA[raid 1]]></category> <category><![CDATA[raid configurations]]></category> <category><![CDATA[raid levels]]></category> <category><![CDATA[redundancy]]></category> <category><![CDATA[SATA]]></category> <category><![CDATA[SCSI]]></category> <category><![CDATA[Serial ATA]]></category> <category><![CDATA[software raid]]></category> <category><![CDATA[storage management]]></category> <category><![CDATA[XOR]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=6189</guid> <description><![CDATA[The first part of this series gave readers step-by-step instructions to build Openfiler from scratch. This second part covers two additional important features of Openfiler: bonded interfaces and software RAID. We also have...]]></description> <content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-6192" title="Open File(er)" src="http://cdn.linuxforu.com/wp-content/uploads/2011/11/openfiler-2-350x328.jpg?d9c344" alt="Open File(er)" width="350" height="328" /></p><div class="introduction">The <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">first part of this series</a> gave readers step-by-step instructions to build Openfiler from scratch. This second part covers two additional important features of Openfiler: bonded interfaces and software RAID. We also have a set of crucial troubleshooting instructions, if the bonded interface configuration fails during setup.</div><p>The earlier article used a standard PC based on an Intel dual-core 2.8 GHz CPU, 1 GB RAM, a single 100 MBps Ethernet card, and a SATA 80 GB hard disk. To create bonded interface and software RAID configurations, one Fast Ethernet card and two 500 GB hard disks were added to this original hardware.</p><p>Before starting the actual set-up, let us understand the basics of bonded interfaces and various RAID levels.</p><p><strong>Bonded interface:</strong> A standard SATA II hard disk gives a write speed of 6 Gigabits per second. Fast Ethernet transfers 100 Megabits per second and Gigabit Ethernet 1 Gigabit per second. Thus, the network speed is six to sixty times lower than hard disk write speeds. Bonding two interfaces into a single one bridges this speed difference. Here, typically, two independent Ethernet interfaces with their own IP addresses are bonded to be accessed as a single interface by an additional third IP address, thus creating twice the bandwidth. Bonding is also possible for more than two interfaces. Bonded interface also provide redundancy if one of the Ethernet cards interface fail.</p><p><strong>RAID:</strong> Openfiler supports RAID levels 0, 1, 5, 6 and 10, which are explained in brief for ready reference. For more information, please see the <a href="http://en.wikipedia.org/wiki/RAID">Wikipedia article on RAID</a>.</p><ol><li><strong>RAID 0 (block-level striping without parity):</strong> Given two hard disks (the minimum), a block of data to be written is split into two equal parts and written on the two disks. This almost doubles write performance. There is no redundancy; if one disk fails, all data is lost.</li><li><strong>RAID 1 (mirroring without parity or striping):</strong> This requires a minimum of two hard disks. Whatever is written on Disk A is duplicated on Disk B, providing 1-to-1 redundancy. This level can sustain failure of one disk without losing data. When a faulty disk is replaced, the RAID controller automatically synchronises the data.</li><li><strong>RAID 5 (block-level striping with distributed parity):</strong> This level requires a minimum of three hard disks and tolerates failure of one disk without loss of data. Given three disks, A, B and C, and three data blocks to be written on them, Table 1 shows how the blocks are stored, after splitting each into two equal parts.<br /><table border="0"><thead><tr><td colspan="3">Table 1: RAID 5 storage structure</td></tr><tr><td>Block</td><td>Data</td><td>Parity</td></tr></thead><tbody><tr><td>First block</td><td>Disk A and B</td><td>Disk C</td></tr><tr><td>Second block</td><td>Disk B and C</td><td>Disk A</td></tr><tr><td>Third block</td><td>Disk C and A</td><td>Disk B</td></tr></tbody></table><p>The parity information is calculated using the logical Exclusive-OR (XOR) function. Table 2 helps understand the function, and how it is used to reconstruct data to be written on a replacement hard disk.</p><table border="0"><thead><tr><td colspan="3">Table 2: XOR truth table and disks where data and parity are written</td></tr><tr><td>Data A</td><td>Data B</td><td>Parity</td></tr></thead><tbody><tr><td>0</td><td>0</td><td>0</td></tr><tr><td>0</td><td>1</td><td>1</td></tr><tr><td>1</td><td>0</td><td>1</td></tr><tr><td>1</td><td>1</td><td>0</td></tr><tr><td>Disk A</td><td>Disk B</td><td>Disk C</td></tr></tbody></table><p>With XOR, when data A and data B are equal, the parity is 0; when not equal, parity is 1. Now let&#8217;s assume Disk A fails. At this point, we have correct values for data B and parity, stored on disks B and C. After the faulty disk is replaced, the RAID controller recalculates and writes the correct data to it, using the following rules:</p><ul><li>If Data B and Parity both are 0, Data A is 0.</li><li>If Data B is 1 and Parity is 0, Data A is 1.</li><li>If Data B is 0 and Parity is 1, Data A is 1.</li><li>If Data B and Parity both are 1, Data A is 0.</li></ul><p>There are two disadvantages of using this RAID level:</p><ul><li>During synchronisation (rebuilding the RAID array), the array&#8217;s read-write performance is greatly reduced due to calculation overhead.</li><li>If any other disk fails during synchronisation, the whole array is destroyed.</li></ul></li><li><strong>RAID 6 (block-level striping with double distributed parity):</strong> This level uses two parity disks instead of one as in the case of RAID 5; thus, it can tolerate failure of two hard disks in an array, at a time.</li><li><strong>RAID 10 (stripe of mirrors):</strong> Combines RAID 0 and 1. Two RAID 1 arrays are striped using RAID 0, thus providing speed as well as redundancy.</li></ol><p>Now, after the basics, let&#8217;s proceed with Openfiler configuration of bonded interfaces and RAID levels.</p><h2>Bonded interface configuration</h2><p>First, the prerequisites: a minimum of two Ethernet cards (eth0 and eth1) and two additional IP addresses in the same range as the Openfiler installation (the third IP is for the bonded interface bond0).</p><p>Now that we have the bare minimum, open the Openfiler Web interface (<code>https://ipaddress:446</code>), log in and go to <em>System &#8211;&gt; Network Interface Configuration</em>. Edit the eth1 configuration, and enter the IP address and subnet mask for this interface (see Figure 1).</p><div id="attachment_6198" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/1-Eth1-Configuration.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/1-Eth1-Configuration-590x310.jpg?d9c344" alt="Network interface configuration" title="Network interface configuration" width="590" height="310" class="size-large wp-image-6198" /></a><p class="wp-caption-text">Figure 1: Network interface configuration</p></div><p>Proceed with bonding the two interfaces once the second interface is configured (Figures 2 and 3).</p><div id="attachment_6199" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/2-Bonding-two-interfaces.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/2-Bonding-two-interfaces-590x442.jpg?d9c344" alt="Bonding two interfaces" title="Bonding two interfaces" width="590" height="442" class="size-large wp-image-6199" /></a><p class="wp-caption-text">Figure 2: Bonding two interfaces</p></div><div id="attachment_6200" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/3-Network-Bonding-Configuration-1.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/3-Network-Bonding-Configuration-1-590x342.jpg?d9c344" alt="Network bonding configuration1" title="Network bonding configuration1" width="590" height="342" class="size-large wp-image-6200" /></a><p class="wp-caption-text">Figure 3: Network bonding configuration1</p></div><p>Continue to give the bonded IP address and subnet mask, leaving all other parameters at their default values (Figure 4).</p><div id="attachment_6202" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/4-Network-Bonding-Configuration-2.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/4-Network-Bonding-Configuration-2-590x505.jpg?d9c344" alt="Network bonding configuration2" title="Network bonding configuration2" width="590" height="505" class="size-large wp-image-6202" /></a><p class="wp-caption-text">Figure 4: Network bonding configuration2</p></div><p>Select the bonding type as balance-alb (adaptive load balancing). Various other modes available provide combinations of load balancing methods and failover. Verify the new network configuration (Figure 5).</p><div id="attachment_6203" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/5-Configured-Bonded-Interfaces.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/5-Configured-Bonded-Interfaces-590x192.jpg?d9c344" alt="Configured bonded interfaces" title="Configured bonded interfaces" width="590" height="192" class="size-large wp-image-6203" /></a><p class="wp-caption-text">Figure 5: Configured bonded interfaces</p></div><p>Now, you won&#8217;t be able to access the Web GUI via the eth0 address. Instead, connect to <code>https://bond0address:446</code>.</p><div class="note"><strong>Caution:</strong> Do not abandon the configuration in between. It is highly recommended that a bond be configured only if direct terminal access is possible to reconfigure, in case a problem arises.</div><h2>RAID configuration</h2><p>Now, let us proceed to add RAID volumes to the box. We shall create RAID 1 100 GB volumes on the two new 500 GB hard disks.</p><p>Proceed to <em>Volume &#8211;&gt; Block devices</em>. This (Figure 6) reflects all hard disks. Openfiler detects SATA hard disks as SCSI, but check the description &#8212; it is still ATA with exact model numbers. You can easily figure out from the description that the sda and sdc hard disks are Seagate, and sdb is Hitachi.</p><div id="attachment_6204" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/6-Block-Device-Management.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/6-Block-Device-Management-590x233.jpg?d9c344" alt="Block device management" title="Block device management" width="590" height="233" class="size-large wp-image-6204" /></a><p class="wp-caption-text">Figure 6: Block device management</p></div><p>Define 100 GB RAID array partitions on <code>/dev/sda</code> and <code>/dev/sdc</code> (Figure 7).</p><div id="attachment_6205" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/7-Creating-RAID-Partition.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/7-Creating-RAID-Partition-590x312.jpg?d9c344" alt="Creating RAID partition" title="Creating RAID partition" width="590" height="312" class="size-large wp-image-6205" /></a><p class="wp-caption-text">Figure 7: Creating RAID partition</p></div><p>Select <em>Volume -–&ft; Software RAID</em> and create a new RAID array <code>/dev/md0</code> (Figure 8).</p><div id="attachment_6206" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/8-Create-a-new-RAID-array.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/8-Create-a-new-RAID-array-590x369.jpg?d9c344" alt="Creating a new RAID array" title="Creating a new RAID array" width="590" height="369" class="size-large wp-image-6206" /></a><p class="wp-caption-text">Figure 8: Creating a new RAID array</p></div><p>Create a new volume group (let&#8217;s name it &#8220;raid1group&#8221; in <code>/dev/md0</code> (Figures 9 and 10).</p><div id="attachment_6207" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/9-Creating-New-Volume-Group-in-RAID-Array.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/9-Creating-New-Volume-Group-in-RAID-Array-590x483.jpg?d9c344" alt="Creating new volume group in RAID array" title="Creating new volume group in RAID array" width="590" height="483" class="size-large wp-image-6207" /></a><p class="wp-caption-text">Figure 9: Creating new volume group in RAID array</p></div><div id="attachment_6208" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/09/10-RAID1group-Array-successfully-created.jpg?d9c344"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/10-RAID1group-Array-successfully-created-590x209.jpg?d9c344" alt="raid1group array successfully created" title="raid1group array successfully created" width="590" height="209" class="size-large wp-image-6208" /></a><p class="wp-caption-text">Figure 10: raid1group array successfully created</p></div><p>The <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">first article</a> explained addition of volumes for firstvolume. Exactly the same steps are required to be followed to create volumes on raid1group. (For installation purposes, you can treat a RAID volume as any standard volume created in Openfiler.) So, proceed with: <em>Add Volume &#8211;&gt; Raid1Group</em>. Give the volume name as &#8220;Database&#8221;, and description as &#8220;database storage&#8221;. Allot the full 100 GB space to the volume, and select ext3 partition, to finally create the volume. The time required for creating the volume will depend on machine speed.</p><p>Proceed to define groups, users, and assign quotas to groups and users. Please refer to the <a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" title="Storage Management using Openfiler, Part 1">previous article</a> for detailed steps.</p><div class="note"><strong>Note:</strong> Once configuration is complete, be sure to save a backup of the system configuration from the System menu, and LDAP configuration from the <em>LDAP Setup</em> menu.</div><p>The benefits of using a separate disk for OS, and two additional disks for RAID 1 volumes, are:</p><ol><li>The operating system resides on a separate hard disk, and doesn&#8217;t occupy RAID space.</li><li>Important data is mirrored in a RAID 1 volume.</li><li>If the OS disk fails, you can install a fresh OS and restore the backup of the configuration, to restore the Openfiler configuration.</li><li>If one of the 500 GB hard disks fails, you can replace that hard disk and reconstruct the RAID 1 array.</li></ol><h2>Important troubleshooting tips for bonded interface</h2><p>If you misconfigure or cancel the bonded interface setup, the GUI access to Openfiler stops working. Here is what you should do in such a case. Connect a keyboard and monitor to the Openfiler system, and log in as root. Run the following commands:</p><pre class="brush: text; gutter: false;">cd /etc/sysconfig/network-scripts ## Change directory to network
rm ifcfg-bond0 ## Remove bond0 interface</pre><p>Ensure that <code>ifcfg-eth0</code> file has the following lines (adjusted for your configuration) or add them:</p><pre class="brush: text; gutter: false;">DEVICE=eth0
BOOTPROT=static
BROADCAST=192.168.51.255
IPADDR=192.168.51.200
NETMASK=255.255.255.0
NETWORK=192.168.51.1
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.51.1</pre><p>Restart the network service (<code>/etc/init.d/network restart</code> or <code>service network restart</code>). Access the Web GUI at the configured eth0 IP address. Redo the bonding configuration properly.</p><p>That&#8217;s all for this time, folks!<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 3</a></li><li><a href="http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 4</a></li><li><a href="http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 1</a></li><li><a href="http://www.linuxforu.com/2011/12/ipcop-firewall-installation-basics/" rel="bookmark" class="crp_title">Guard Your Network with IPCop, Part 1: Installation Basics</a></li><li><a href="http://www.linuxforu.com/2011/05/quick-quide-to-qemu-setup/" rel="bookmark" class="crp_title">The Quick Guide to QEMU Setup</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/ethernet/" title="Ethernet" rel="tag">Ethernet</a>, <a href="http://www.linuxforu.com/tag/ethernet-cards/" title="Ethernet cards" rel="tag">Ethernet cards</a>, <a href="http://www.linuxforu.com/tag/fast-ethernet/" title="Fast Ethernet" rel="tag">Fast Ethernet</a>, <a href="http://www.linuxforu.com/tag/hard-disk-drive/" title="Hard disk drive" rel="tag">Hard disk drive</a>, <a href="http://www.linuxforu.com/tag/hard-disks/" title="hard disks" rel="tag">hard disks</a>, <a href="http://www.linuxforu.com/tag/ip-address/" title="IP address" rel="tag">IP address</a>, <a href="http://www.linuxforu.com/tag/lfy-september-2011/" title="LFY September 2011" rel="tag">LFY September 2011</a>, <a href="http://www.linuxforu.com/tag/load-balancing/" title="load-balancing" rel="tag">load-balancing</a>, <a href="http://www.linuxforu.com/tag/openfiler/" title="Openfiler" rel="tag">Openfiler</a>, <a href="http://www.linuxforu.com/tag/raid/" title="RAID" rel="tag">RAID</a>, <a href="http://www.linuxforu.com/tag/raid-0/" title="raid 0" rel="tag">raid 0</a>, <a href="http://www.linuxforu.com/tag/raid-1/" title="raid 1" rel="tag">raid 1</a>, <a href="http://www.linuxforu.com/tag/raid-configurations/" title="raid configurations" rel="tag">raid configurations</a>, <a href="http://www.linuxforu.com/tag/raid-levels/" title="raid levels" rel="tag">raid levels</a>, <a href="http://www.linuxforu.com/tag/redundancy/" title="redundancy" rel="tag">redundancy</a>, <a href="http://www.linuxforu.com/tag/sata/" title="SATA" rel="tag">SATA</a>, <a href="http://www.linuxforu.com/tag/scsi/" title="SCSI" rel="tag">SCSI</a>, <a href="http://www.linuxforu.com/tag/serial-ata/" title="Serial ATA" rel="tag">Serial ATA</a>, <a href="http://www.linuxforu.com/tag/software-raid/" title="software raid" rel="tag">software raid</a>, <a href="http://www.linuxforu.com/tag/storage-management/" title="storage management" rel="tag">storage management</a>, <a href="http://www.linuxforu.com/tag/xor/" title="XOR" rel="tag">XOR</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Amanda: A One-Stop Solution for All Your Backup Problems</title><link>http://www.linuxforu.com/2011/09/amanda-one-stop-solution-for-backup-problems/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=amanda-one-stop-solution-for-backup-problems</link> <comments>http://www.linuxforu.com/2011/09/amanda-one-stop-solution-for-backup-problems/#comments</comments> <pubDate>Wed, 31 Aug 2011 18:34:23 +0000</pubDate> <dc:creator>Ankit Mathur</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[amanda]]></category> <category><![CDATA[Amazon S3]]></category> <category><![CDATA[architectural complexity]]></category> <category><![CDATA[automation scripts]]></category> <category><![CDATA[backup]]></category> <category><![CDATA[backup facility]]></category> <category><![CDATA[backup server]]></category> <category><![CDATA[backup solutions]]></category> <category><![CDATA[backup utilities]]></category> <category><![CDATA[configure amanda]]></category> <category><![CDATA[enterprise solution]]></category> <category><![CDATA[install amanda]]></category> <category><![CDATA[Kerberos]]></category> <category><![CDATA[LFY September 2011]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[linux servers]]></category> <category><![CDATA[Mac OSX]]></category> <category><![CDATA[network backup]]></category> <category><![CDATA[OpenSSH]]></category> <category><![CDATA[server environments]]></category> <category><![CDATA[Solaris]]></category> <category><![CDATA[University of Maryland]]></category> <category><![CDATA[unix]]></category> <category><![CDATA[Windows]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5409</guid> <description><![CDATA[Looking for an enterprise backup solution for your servers? Is your network too complex to be handled by simple backup utilities? Does the thought of making backups feel like a headache? Do not...]]></description> <content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-5576" title="Back it up now, c'mon..." src="http://cdn.linuxforu.com/wp-content/uploads/2011/09/amanda-590x325.jpg?d9c344" alt="Back it up now, c'mon..." width="590" height="325" /></p><div class="introduction">Looking for an enterprise backup solution for your servers? Is your network too complex to be handled by simple backup utilities? Does the thought of making backups feel like a headache? Do not worry, there’s Amanda to the rescue!</div><p>Amanda is probably one of the best open source network backup solutions available in the market today. The Advanced Maryland Automatic Network Disk Archiver (Amanda), as the name suggests, was developed at the University of Maryland. It allows the administrator to set up a single master backup server to backup multiple hosts over the network, to tape drives, to disks or to optical media, and even the cloud (with the help of Amazon S3 Web services). It provides an array of options for the type of media that can be backed up to, and a multitude of client environments.</p><p>Amanda is basically like an enterprise solution that does require a bit of configuration initially, but after that, it&#8217;s a breeze. But don&#8217;t let this put you off, because along with a tool like Amanda comes great flexibility and reliability, which allows it to work efficiently in the most complex of architectural environments. A variety of client operating systems are now supported, ranging from UNIX to all flavours of Linux, Solaris, Mac OSX and Windows. Overall, it&#8217;s a great utility, which you will fall in love with once you get used to it.</p><h2>Why Amanda?</h2><p>The most basic questions are:</p><ul><li>Why should you spend so much time struggling with Amanda, when you can use simple command-line automation scripts for your Linux servers?</li><li>Even if you do decide to use a backup utility, why should you spend so much time and resources to set up software like Amanda?</li></ul><p>The answer lies in the following three factors: scalability, flexibility and architectural complexity, which decide whether you need Amanda or not. Basically, Amanda is suited for those who have a multitude of systems with varying server environments, and it is really expensive to have a separate backup facility for each of these.</p><p>Amanda provides you with a dedicated backup server for the whole kit, making the backup process reliable, well-planned and efficient. Also, it allows for really good scalability and freedom when it comes to expanding your network. After adding new clients to the network, all you need to do is make a few changes in the configuration and you&#8217;re done; you can let Amanda handle the rest.</p><p>This essentially makes it quite future-proof. Otherwise, if your network is not that complex, I would frankly recommend a simpler solution for you, because Amanda might prove to be a bit of overkill in such scenarios.</p><p>One big advantage that Amanda has is that the data can easily be obtained with native tools, even if the Amanda server is rendered completely unusable (that, of course, does not mean that the data is not safe; it does have really good security features).</p><h2>Features</h2><ul><li><strong>Client-server architecture:</strong> Obviously, this is one of the most important features. A unique feature is that it is the server that schedules and decides which client is to be backed up, and requests clients for data, instead of clients requesting the server. Also, all configuration related to the backup plan is done on the server. Amanda also has a really good media interface, without having any device driver-based dependencies.</li><li><strong>Automatic backup level selection:</strong> Amanda uses the concept of a &#8220;backup level&#8221; to distinguish different kinds of backups. Each backup type has a level number assigned to it; for example, a full backup is Level 0. Backing up the system at any level means saving all the files that have changed since the last backup at the previous level. Thus, a Level 1 backup saves all the files that have changed since the last full (Level 0) backup; a Level 2 backup saves all the files that have been changed since the last Level 1 backup, and so on. It determines the backup level automatically, rather than making the administrator determine this ahead of time.</li><li><strong>A consistent backup window and resource utilisation:</strong> Amanda provides a consistent plan for all your backups, such that there are no spikes in media and server resource utilisation &#8212; and you can set a specific time-frame within which backups are to happen.</li><li><strong>An intelligent backup scheduler:</strong> It determines the amount of data changed for a client, and schedules accordingly. The administrator only specifies a few parameters according to which backups are to occur. It basically distributes full backups with incremental ones over the backup cycle, to balance the amount of data that is backed up at a time. The scheduler skips any clients that could not be backed up, or were not available at the instant, and reschedules when they are available again.</li><li><strong>Data encryption and compression:</strong> Data compression options are plentiful. Compression can happen on the client or server, depending on the configuration specification. Encryption with OpenSSH and Kerberos is available, making it secure enough.</li><li><strong>Reporting and verification:</strong> The <code>amreport</code> tool provides reports on each backup run, along with detailed statistics. It also sends overnight email notifications to the administrators. The <code>amverify</code> tool checks the Amanda format on a drive, and whether it can be restored to a healthy state.</li></ul><h2>Installation and configuration</h2><p>As far as installation is concerned, it turns out to be pretty easy; it&#8217;s the setting up and initial configuration that takes time. For most Linux systems, Amanda is available in repositories as the packages <code>amanda-common</code> and <code>amandaserver</code>, which, as the names suggest, need to be installed at their respective places. Some of the main dependency requirements for Amanda, which must be installed on the system before trying to install Amanda, are:</p><ul><li>GNU Tar 1.15 or later</li><li>Samba for communication with Windows clients</li><li>Perl 5.6 or later</li><li>Glib version 2.2 or later</li><li>Awk and Gnuplot for the <code>amplot</code> utility</li></ul><p>The installation creates a new user, &#8216;amanda&#8217; (or something similar), to run the Amanda backup and other tools. Configuration files are created in <code>/etc/amanda</code>, including an example configuration to play around with; this can serve as an overview, but is not of much practical use. To create a new configuration, we need to create a folder under <code>/etc/amanda</code>, the name of which will represent a particular configuration for Amanda. In this directory will be the <code>amanda.conf</code> file, which contains the following pieces of major information:</p><ul><li><code>org</code>: The email subject, to differentiate between various backups.</li><li><code>mailto</code>: Administrator email address(es) to which to send reports (multiple addresses to be separated with spaces).</li><li><code>tapecycle</code>: The number of tapes that are available, and to be circulated.</li><li><code>dumpcycle</code>: The number of days in the total dump cycle.</li><li><code>runspercycle</code>: The number of daily full backups to be taken.</li><li><code>tapedev /dev/null</code>: This should be changed to <code>tapedev /dev/nst0</code>, which is the non-rewinding device for Linux.</li><li><code>tapetype</code>: The configuration of the tape drive that Amanda will be using. There is a utility called <code>amtapetype</code>, which performs writes to the tape to determine the capacity and speed.</li></ul><p>The values for <code>tapecyle</code>, <code>dumpcycle</code> and <code>runspercycle</code> depend on the backup plan you choose, and the strategy you plan to undertake. There are a couple of other parameters in the file, which should be self-explanatory.</p><p>Now, we need to label the tapes. This is very important, because tapes are rejected if they are found to be improperly labelled during a backup run. This should be done with the <code>amlabel</code> utility, as the &#8216;amanda&#8217; user, and to create labels that match the regular expression specified in the particular <code>amanda.conf</code> file. We&#8217;ll now want to add entries to the disklist file in the configuration directory, i.e., tell Amanda which directories on the client need to be backed up. Finally, the <code>amcheck</code> utility is used to check the validity of the configuration; if it reports no errors, you are good to go!</p><p>Go on and run <code>amdump</code> to take a trial run. The command won&#8217;t print anything, but a report of the backup can be generated with <code>amreport</code> (it will also probably send an email to report everything when it is done). Once we have everything set up well, it&#8217;s time for <code>cron</code> to take over and automate the process every night.</p><p>Recovering data from Amanda is pretty easy, though this time, the client needs to be set up to pull data from the server. This can be done in the <code>amanda-client.conf</code> file of the configuration directory, after which the <code>amrecover</code> utility handles everything.</p><p>In conclusion, this article tries to present to the user what it takes to set up and get an Amanda backup running. Though it is recommended to go through the official documentation while actually setting up Amanda, this involves taking care of a lot of the nitty-gritties of the configuration. Though the set-up process might look easy after reading this article, it is actually a bit harder, and might require more than one attempt. But once everything falls into place, it becomes pretty easy to run such a powerful tool on your server.</p><h5>Further reading</h5><ol><li><a href="http://wiki.zmanda.com/index.php/GSWA" target="_blank">Amanda Wiki</a></li><li><a href="http://www.novell.com/coolsolutions/feature/18050.html" target="_blank">Using Amanda to Backup your Linux Server</a></li></ol><div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/09/demystifying-backups/" rel="bookmark" class="crp_title">Demystifying Backups</a></li><li><a href="http://www.linuxforu.com/2011/10/backups-and-more-with-rsync/" rel="bookmark" class="crp_title">Backups and More with rsync</a></li><li><a href="http://www.linuxforu.com/2009/06/puppet-show-automating-unix-administration/" rel="bookmark" class="crp_title">Puppet Show: Automating UNIX Administration</a></li><li><a href="http://www.linuxforu.com/2011/06/telecom-service-provider-handles-huge-volumes-of-data-using-postgresql/" rel="bookmark" class="crp_title">A Telecom Service Provider Handles Huge Volumes of Data Using PostgreSQL</a></li><li><a href="http://www.linuxforu.com/2011/12/fedora-scientific-open-source-scientific-computing/" rel="bookmark" class="crp_title">Fedora Scientific: Open Source Scientific Computing</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/amanda/" title="amanda" rel="tag">amanda</a>, <a href="http://www.linuxforu.com/tag/amazon-s3/" title="Amazon S3" rel="tag">Amazon S3</a>, <a href="http://www.linuxforu.com/tag/architectural-complexity/" title="architectural complexity" rel="tag">architectural complexity</a>, <a href="http://www.linuxforu.com/tag/automation-scripts/" title="automation scripts" rel="tag">automation scripts</a>, <a href="http://www.linuxforu.com/tag/backup/" title="backup" rel="tag">backup</a>, <a href="http://www.linuxforu.com/tag/backup-facility/" title="backup facility" rel="tag">backup facility</a>, <a href="http://www.linuxforu.com/tag/backup-server/" title="backup server" rel="tag">backup server</a>, <a href="http://www.linuxforu.com/tag/backup-solutions/" title="backup solutions" rel="tag">backup solutions</a>, <a href="http://www.linuxforu.com/tag/backup-utilities/" title="backup utilities" rel="tag">backup utilities</a>, <a href="http://www.linuxforu.com/tag/configure-amanda/" title="configure amanda" rel="tag">configure amanda</a>, <a href="http://www.linuxforu.com/tag/enterprise-solution/" title="enterprise solution" rel="tag">enterprise solution</a>, <a href="http://www.linuxforu.com/tag/install-amanda/" title="install amanda" rel="tag">install amanda</a>, <a href="http://www.linuxforu.com/tag/kerberos/" title="Kerberos" rel="tag">Kerberos</a>, <a href="http://www.linuxforu.com/tag/lfy-september-2011/" title="LFY September 2011" rel="tag">LFY September 2011</a>, <a href="http://www.linuxforu.com/tag/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://www.linuxforu.com/tag/linux-servers/" title="linux servers" rel="tag">linux servers</a>, <a href="http://www.linuxforu.com/tag/mac-osx/" title="Mac OSX" rel="tag">Mac OSX</a>, <a href="http://www.linuxforu.com/tag/network-backup/" title="network backup" rel="tag">network backup</a>, <a href="http://www.linuxforu.com/tag/openssh/" title="OpenSSH" rel="tag">OpenSSH</a>, <a href="http://www.linuxforu.com/tag/server-environments/" title="server environments" rel="tag">server environments</a>, <a href="http://www.linuxforu.com/tag/solaris/" title="Solaris" rel="tag">Solaris</a>, <a href="http://www.linuxforu.com/tag/university-of-maryland/" title="University of Maryland" rel="tag">University of Maryland</a>, <a href="http://www.linuxforu.com/tag/unix/" title="unix" rel="tag">unix</a>, <a href="http://www.linuxforu.com/tag/windows/" title="Windows" rel="tag">Windows</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/09/amanda-one-stop-solution-for-backup-problems/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Storage Management using Openfiler, Part 1</title><link>http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storage-management-using-openfiler-part-1</link> <comments>http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/#comments</comments> <pubDate>Sun, 31 Jul 2011 18:38:45 +0000</pubDate> <dc:creator>Rajesh Deodhar</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[Citrix]]></category> <category><![CDATA[Ethernet]]></category> <category><![CDATA[hardware raid]]></category> <category><![CDATA[iSCSI]]></category> <category><![CDATA[LDAP]]></category> <category><![CDATA[LFY August 2011]]></category> <category><![CDATA[Linux distro]]></category> <category><![CDATA[Microsoft Windows]]></category> <category><![CDATA[NAS]]></category> <category><![CDATA[Openfiler]]></category> <category><![CDATA[quota management]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[raid support]]></category> <category><![CDATA[RAM]]></category> <category><![CDATA[SAN]]></category> <category><![CDATA[SATA]]></category> <category><![CDATA[simultaneous connections]]></category> <category><![CDATA[storage management]]></category> <category><![CDATA[storage options]]></category> <category><![CDATA[storage volumes]]></category> <category><![CDATA[UPS]]></category> <category><![CDATA[virtual machine environment]]></category> <category><![CDATA[VMWare]]></category> <category><![CDATA[volumes]]></category> <category><![CDATA[Web administration]]></category> <category><![CDATA[Web server]]></category> <category><![CDATA[Web-based GUI]]></category> <category><![CDATA[Windows domain controller]]></category> <category><![CDATA[XenServer]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5104</guid> <description><![CDATA[Many companies use the file-sharing features of a popular proprietary desktop operating system. The main constraint is the limit on simultaneous connections to a single file share (10). The proprietary solution is to...]]></description> <content:encoded><![CDATA[<p><img class="alignright size-full wp-image-6498" title="Storage management using Openfiler" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openfiler-1.jpeg?d9c344" alt="Storage management using Openfiler" width="350" height="318" /></p><div class="introduction">Many companies use the file-sharing features of a popular proprietary desktop operating system. The main constraint is the limit on simultaneous connections to a single file share (10). The proprietary solution is to purchase a proprietary server OS license, and go on buying Client Access Licenses (CALs) for each additional connected device. However, Openfiler, an Open Source Storage Management Appliance, can be used very effectively in this situation, to deliver fantastic functionality and granular access control.</div><p>We will try to appraise this interesting and feature-rich Linux distro in a series of articles. This first part covers basic Openfiler installation and configuration, and its various storage options for a 64-bit standard installation. Openfiler can convert any computer system complying with the minimum requirements to a storage server. The specifications, from the Openfiler website, are in the following table.</p><table border="0"><thead><tr><td>Minimum Specifications</td><td>Recommended Specifications (over the minimum specs)</td></tr></thead><tbody><tr><td><ul><li>32-bit 1GHz or higher-performance processor</li><li>2GB or more or RAM</li><li>2GB disk space for memory/swap area</li><li>8GB disk space for Openfiler OS installation</li><li>100MB Ethernet network interface</li><li>Separate storage volumes/disks for data export</li></ul></td><td><ul><li>64-bit 1.6GHz or higher-performance processor</li><li>1GB Ethernet network interface</li><li>Hardware RAID controller</li></ul></td></tr></tbody></table><p>The website further mentions that Openfiler is compatible with 32-bit and 64-bit industry standard server hardware too. It can also be installed in a virtual-machine environment such as VMWare or XenServer, as a guest OS. Future releases of Openfiler may only support 64-bit processors, so they are highly recommended for new Openfiler installations. Some important advantages of using Openfiler are:</p><ul><li>No licensing cost</li><li>Multiple NIC bonding</li><li>Support for iSCSI targets</li><li>Software RAID support</li><li>Remote replication for Disaster Recovery</li><li>High Availability (HA) cluster fail-over capability</li></ul><p>Openfiler also has various other features available on standard Network Attached Storage (NAS) boxes, including access via FTP, Web server and SMB/CIFS services; authentication against a local (or remote) LDAP server, or integration with a Windows domain controller; user/group-wise access control and quota management; configuration via an easy Web-based GUI; free updates and patches. Help is available via excellent community support.</p><h2>Getting started</h2><p>To start exploring this wonderful distro, download your desired image from the Openfiler website. Various images are available: 32/64 bit ISOs, and various appliances for VMWare, VMWare ESX and Citrix XenServer. Our installation is based on the Openfiler 2.3 Installation ISO image (for x86/64). The hardware used here is a simple PC with an Intel 2.8 GHz dual-core CPU, with 1 GB of RAM and an 80 GB SATA hard disk.</p><div class="note"><strong>Caution:</strong> For a fresh setup, the target hard disk for installation will be wiped &#8220;clean&#8221; by the installer. Ensure any desired data is backed up!</div><p>Start the installation by booting from a CD prepared from the downloaded ISO image. Openfiler supports a text- as well as GUI-based installation; continue with the latter. There are practically no surprises during this installation process. The most important steps during installation are hard-disk partitioning and networking, which are explained here.</p><h2>Disk partitioning</h2><p>If you have two hard disks installed in the computer, select the first hard disk for installation. Partition the hard disk manually, if you have a single hard disk.</p><div class="note"><strong>Note:</strong> if you choose auto partitioning, all the disk space is taken for the Openfiler distro, leaving no space for data.</div><p>Create three partitions, as detailed in the table below. Tick the &#8220;Force to be a primary partition&#8221; check-box while creating all the three partitions.</p><table border="0"><thead><tr><td>Partition</td><td>Mount Point</td><td>Minimum Size</td><td>Recommended Size</td><td>Filesystem</td><td>Purpose</td></tr></thead><tbody><tr><td>Boot</td><td>/boot</td><td>100MB</td><td>256MB</td><td>ext3</td><td>Kernel and other files needed for booting</td></tr><tr><td>Root</td><td>/</td><td>1024MB</td><td>2048MB</td><td>ext3</td><td>OS installation</td></tr><tr><td>Swap</td><td>N/A</td><td>1024MB</td><td>2048MB</td><td>N/A</td><td>Swap space</td></tr></tbody></table><h2>Network configuration</h2><p>Ensure you enter correct values for hostname, default gateway and DNS servers. These settings are important for patching Openfiler. Though Openfiler can get an IP address from a DHCP server, use the <em>Edit</em> tab at the top right corner to specify a static IP address and subnet mask. Don&#8217;t forget to tick the &#8220;Activate on boot&#8221; check-box.</p><p>Continue through the rest of the installation, and reboot to complete the first phase of installation. The Openfiler box can now be accessed in these ways:</p><ol><li>Use the username root and the password configured during the installation process for access at the Openfiler PC console, or via SSH from another system.</li><li>Access the Web administration interface by navigating to <code>https://ipaddress:446</code> (the IP address of the Openfiler PC) from any node. Here, the default login name is <em>openfiler</em>, and the password is <em>password</em>.</li></ol><h2>Updates</h2><p>Immediately after the first reboot, patch the new installation. Log in at the console, and run the command <code>conary updateall</code>. The time required for updates depends on your Internet connection speed. Repeat the same command till you get a &#8220;Nothing to be updated&#8221; message. Now the installation is at the stage where you can create volumes, shares, groups and users, and start using the Openfiler box.</p><p>Log in to the Web administration interface. The first screen you see is status (Figure 1), where hardware and important system information is displayed.</p><div id="attachment_6499" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/1-Status-Screen.jpg?d9c344"><img class="size-large wp-image-6499" title="Status screen" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/1-Status-Screen-590x371.jpg?d9c344" alt="Status screen" width="590" height="371" /></a><p class="wp-caption-text">Figure 1: Status screen</p></div><h2>Initial set-up</h2><p>Proceed to the System tab (Figure 2), which has the options to (re-)configure Openfiler system parameters like network configuration; clock setup (define a Network Time Protocol (NTP) server address and time zone); UPS setup (Openfiler, if connected to an intelligent UPS, can be configured to shutdown when the UPS signals low battery state); backup/restore configuration; and secure console (SSH access).</p><div id="attachment_6501" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/2-System-Screen.jpg?d9c344"><img class="size-large wp-image-6501" title="System screen" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/2-System-Screen-590x369.jpg?d9c344" alt="System screen" width="590" height="369" /></a><p class="wp-caption-text">Figure 2: System screen</p></div><div class="note"><strong>Note:</strong> Some advanced options, such as bonded interface creation and HA cluster setup are not covered here.</div><p>Complete the &#8220;Network Access Configuration&#8221;. You can allows access to a single host, or the full subnet. Under our test setup, we allowed access to the <code>192.168.51.0/255.255.255.0</code>subnet (Figure 3).</p><div id="attachment_6502" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/3-Network-Access-Configuration.jpg?d9c344"><img class="size-large wp-image-6502" title="Network access configuration" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/3-Network-Access-Configuration-590x157.jpg?d9c344" alt="Network access configuration" width="590" height="157" /></a><p class="wp-caption-text">Figure 3: Network access configuration</p></div><p>The next step is to create a volume group on the desired hard disk, using the <em>Volumes</em>tab (Figure 4).</p><div id="attachment_6503" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/4-Volumes-Creation.jpg?d9c344"><img class="size-large wp-image-6503" title="Volume group management" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/4-Volumes-Creation-590x300.jpg?d9c344" alt="Volume group management" width="590" height="300" /></a><p class="wp-caption-text">Figure 4: Volume group management</p></div><p>Under the test setup, the group name was <em>firstvolume</em>. Continue by selecting <em>firstvolume</em> from the <em>Add Volumes</em> tab. The new volume should be defined along with disk-space allocation and volume type (ext3/XFS or iSCSI). Here, we defined <em>Songs</em>as the volume name (Figure 5), allotting 37000 MB of disk space. We preferred ext3, from the data-recovery perspective. The time required to complete this step will vary depending on CPU and hard disk speed.</p><div id="attachment_6504" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/5-New-Volume-Creation.jpg?d9c344"><img class="size-large wp-image-6504" title="New volume creation" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/5-New-Volume-Creation-590x477.jpg?d9c344" alt="New volume creation" width="590" height="477" /></a><p class="wp-caption-text">Figure 5: New volume creation</p></div><div class="note"><strong>Note:</strong> You may use the <em>Managing Volumes</em> tab to increase the size of a created volume (from the corresponding <em>Volume Edit</em> link), and create snapshots of the volumes. Note that once a snapshot is created for a volume, the allotted disk space cannot be increased.</div><h2>Groups and users</h2><p>Next, we create groups and users. The LDAP service must be active to do this. From the <em>Accounts</em> tab, select the <em>Authentication</em> menu. Fill in the LDAP settings (Figure 6), and tick the &#8220;Use Local LDAP Server&#8221; check-box. Submit the configuration information, wait for about a minute, and under the <em>Services</em>tab, verify that the LDAP service is enabled.</p><div id="attachment_6505" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/6-Accounts-LDAP-server.jpg?d9c344"><img class="size-large wp-image-6505" title="Fill in the LDAP server settings" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/6-Accounts-LDAP-server-590x477.jpg?d9c344" alt="Fill in the LDAP server settings" width="590" height="477" /></a><p class="wp-caption-text">Figure 6: Fill in the LDAP server settings</p></div><p>Instead of LDAP, you can configure authentication with a Windows domain controller from this page. <em>Administrator</em> credentials are required to enable access control based on preconfigured groups and usernames. LDAP service configuration may give a few surprises, which will result in failure to create groups and users. Try the following if you are facing problems at this juncture:</p><ol><li>Clear and rebuild the LDAP server from the <em>Services &#8211;&gt; Setup</em> menu.</li><li>Make sure that you have updated Openfiler fully using <code>conary updateall</code> as discussed earlier. If not, do so now. (Community forums report that there was a bug in the original distro, which was fixed by updates. While preparing screenshots for this article, I had taken a shortcut of not updating the distro. Ultimately, LDAP failed, and I had to complete updates before proceeding (Figure 7).</li></ol><div id="attachment_6506" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/7-Conary-Update.jpg?d9c344"><img class="size-large wp-image-6506" title="Console output after a successful 'conary updateall' run" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/7-Conary-Update-e1322553705485-590x457.jpg?d9c344" alt="Console output after a successful 'conary updateall' run" width="590" height="457" /></a><p class="wp-caption-text">Figure 7: Console output after a successful &#39;conary updateall&#39; run</p></div><p>Create a new group, overriding the GID. Here, a GID range starting from 501 is used for the <em>SongLovers</em>group. Additional groups can be created as and when required, for granular access control. Go on creating user accounts with their passwords, and assign them their primary group (Figure 8).</p><div id="attachment_6507" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/8-User-Add.jpg?d9c344"><img class="size-large wp-image-6507" title="Add new user" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/8-User-Add-590x498.jpg?d9c344" alt="Add new user" width="590" height="498" /></a><p class="wp-caption-text">Figure 8: Add new user</p></div><div class="note"><strong>Note:</strong> To change groups and users settings, use the <em>Group/User</em> administration tabs.</div><h2>Quota allocation and shares</h2><p>After creating groups and users, the next task is to allocate quotas. Here, for the <em>SongLovers</em> group, we assign a 20 GB quota. User-wise quota definition is also possible.</p><p>We also created the shares: <em>Firstvolume &#8211;&gt; songs &#8211;&gt; marathi</em> and <em>Firstvolume &#8211;&gt; songs &#8211;&gt; hindi</em>.</p><p>A new share is accessible only after granting specific access. Click the share name and configure the three required parameters &#8212; listed below:</p><ul><li><strong>Share access control mode:</strong> Public guest access or Controlled access</li><li><strong>Group access configuration:</strong> Primary group and type of access &#8212; No access/Read only (RO)/Read-Write (RW)</li><li><strong>Host access configuration:</strong> Type of access to be granted (from 5 possible services: SMB/CISF, NFS, HTTPS, FTP and RSYNC). Select all which you want, and set the share&#8217;s type of access (No/RO or RW).</li></ul><p>Here, we defined the &#8220;marathi&#8221; share with <em>Controlled access</em>, giving the primary group <em>SongLovers</em> RW access. Further, we enabled RW access via SMB/CISF and FTP protocols (Figure 9). (Remember to use the <em>Services</em>menu to enable the FTP service if using FTP shares!)</p><div id="attachment_6508" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/9-Share-Access-Control.jpg?d9c344"><img class="size-large wp-image-6508" title="Share access control" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/9-Share-Access-Control-590x698.jpg?d9c344" alt="Share access control" width="590" height="698" /></a><p class="wp-caption-text">Figure 9: Share access control</p></div><p>That is all, folks!! Start browsing the shared resources by the IP address. You should see your shares—in our case,<em> firstvolume.songs.marathi</em>—as a shared folder. Enter your user credentials, and start using your NAS!</p><p>In future articles, we will continue to discuss various interesting features of Openfiler.</p><h5>References</h5><ul><li>Installation screenshots are available <a href="http://www.openfiler.com/products/screenshots">here</a></li><li>Openfiler <a href="http://openfiler.com/community/forums">forum</a></li><li>Openfiler <a href="http://openfiler.com/community/download/">download page</a></li></ul><p>Special thanks to my friend Achyut Ghare, BE, CISA for introducing me to, this great distro!<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/10/storage-management-using-openfiler-part-3/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 3</a></li><li><a href="http://www.linuxforu.com/2011/11/storage-management-using-openfiler-part-4/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 4</a></li><li><a href="http://www.linuxforu.com/2011/09/storage-management-using-openfiler-part-2/" rel="bookmark" class="crp_title">Storage Management using Openfiler, Part 2</a></li><li><a href="http://www.linuxforu.com/2011/06/lamp-server-in-10-minutes-turnkey/" rel="bookmark" class="crp_title">Turnkey: Build LAMP Server in Under 10 Minutes</a></li><li><a href="http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/" rel="bookmark" class="crp_title">Setting up a LAMP Server Remotely</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/citrix/" title="Citrix" rel="tag">Citrix</a>, <a href="http://www.linuxforu.com/tag/ethernet/" title="Ethernet" rel="tag">Ethernet</a>, <a href="http://www.linuxforu.com/tag/hardware-raid/" title="hardware raid" rel="tag">hardware raid</a>, <a href="http://www.linuxforu.com/tag/iscsi/" title="iSCSI" rel="tag">iSCSI</a>, <a href="http://www.linuxforu.com/tag/ldap/" title="LDAP" rel="tag">LDAP</a>, <a href="http://www.linuxforu.com/tag/lfy-august-2011/" title="LFY August 2011" rel="tag">LFY August 2011</a>, <a href="http://www.linuxforu.com/tag/linux-distro/" title="Linux distro" rel="tag">Linux distro</a>, <a href="http://www.linuxforu.com/tag/microsoft-windows/" title="Microsoft Windows" rel="tag">Microsoft Windows</a>, <a href="http://www.linuxforu.com/tag/nas/" title="NAS" rel="tag">NAS</a>, <a href="http://www.linuxforu.com/tag/openfiler/" title="Openfiler" rel="tag">Openfiler</a>, <a href="http://www.linuxforu.com/tag/quota-management/" title="quota management" rel="tag">quota management</a>, <a href="http://www.linuxforu.com/tag/raid/" title="RAID" rel="tag">RAID</a>, <a href="http://www.linuxforu.com/tag/raid-support/" title="raid support" rel="tag">raid support</a>, <a href="http://www.linuxforu.com/tag/ram/" title="RAM" rel="tag">RAM</a>, <a href="http://www.linuxforu.com/tag/san/" title="SAN" rel="tag">SAN</a>, <a href="http://www.linuxforu.com/tag/sata/" title="SATA" rel="tag">SATA</a>, <a href="http://www.linuxforu.com/tag/simultaneous-connections/" title="simultaneous connections" rel="tag">simultaneous connections</a>, <a href="http://www.linuxforu.com/tag/storage-management/" title="storage management" rel="tag">storage management</a>, <a href="http://www.linuxforu.com/tag/storage-options/" title="storage options" rel="tag">storage options</a>, <a href="http://www.linuxforu.com/tag/storage-volumes/" title="storage volumes" rel="tag">storage volumes</a>, <a href="http://www.linuxforu.com/tag/ups/" title="UPS" rel="tag">UPS</a>, <a href="http://www.linuxforu.com/tag/virtual-machine-environment/" title="virtual machine environment" rel="tag">virtual machine environment</a>, <a href="http://www.linuxforu.com/tag/vmware/" title="VMWare" rel="tag">VMWare</a>, <a href="http://www.linuxforu.com/tag/volumes/" title="volumes" rel="tag">volumes</a>, <a href="http://www.linuxforu.com/tag/web-administration/" title="Web administration" rel="tag">Web administration</a>, <a href="http://www.linuxforu.com/tag/web-server/" title="Web server" rel="tag">Web server</a>, <a href="http://www.linuxforu.com/tag/web-based-gui/" title="Web-based GUI" rel="tag">Web-based GUI</a>, <a href="http://www.linuxforu.com/tag/windows-domain-controller/" title="Windows domain controller" rel="tag">Windows domain controller</a>, <a href="http://www.linuxforu.com/tag/xenserver/" title="XenServer" rel="tag">XenServer</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/08/storage-management-using-openfiler-part-1/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Setup Two-Factor Authentication using OpenOTP</title><link>http://www.linuxforu.com/2011/08/setip-two-factor-authentication-using-openotp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setip-two-factor-authentication-using-openotp</link> <comments>http://www.linuxforu.com/2011/08/setip-two-factor-authentication-using-openotp/#comments</comments> <pubDate>Sun, 31 Jul 2011 18:37:46 +0000</pubDate> <dc:creator>Pradyumna Dash</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[2-factor authentication]]></category> <category><![CDATA[Android]]></category> <category><![CDATA[auth server]]></category> <category><![CDATA[authentication server]]></category> <category><![CDATA[blackberry]]></category> <category><![CDATA[directory service]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[LDAP]]></category> <category><![CDATA[LFY August 2011]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[OpenLDAP]]></category> <category><![CDATA[OpenOTP]]></category> <category><![CDATA[OTP]]></category> <category><![CDATA[RADIUS]]></category> <category><![CDATA[RCDevs]]></category> <category><![CDATA[time passwords]]></category> <category><![CDATA[virtual machine]]></category> <category><![CDATA[WebADM]]></category> <category><![CDATA[Windows Mobile]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=5055</guid> <description><![CDATA[This article is a description of how to use OpenOTP, by RCDevs, to set up a complete environment for two-factor authentication on various servers and for various applications. Readers should have knowledge of...]]></description> <content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-6470" title="Two-factor authentication" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/two-factor-auth-590x224.jpg?d9c344" alt="Two-factor authentication" width="590" height="224" /><div class="introduction">This article is a description of how to use OpenOTP, by RCDevs, to set up a complete environment for two-factor authentication on various servers and for various applications. Readers should have knowledge of OpenLDAP and RADIUS.</div><p>Before I jump into the topic, let me explain what OpenOTP is, and why we may need it. Password-based authentication has been around for a long time &#8212; perhaps even during the days of the Colosseum! &#8212; but is a debatable method, because our secrets are not as secret as we would like them to be. Social engineering, shoulder-surfing (when you log in), eavesdropping, etc., can capture your secret/password. Besides, some people use weak passwords based on easily-found personal data, like ex-girlfriends&#8217; or spouse&#8217;s names, dates of birth, etc. This is where two-factor authentication comes in, helping to keep your network secure.</p><p>Two-factor authentication is any mechanism where more than one thing is required to authenticate a user. The two components of two-factor authentication are:</p><ul><li>Something you know (e.g., password/PIN, etc)</li><li>Something you have (a token, cell phone, etc)</li></ul><p>The &#8220;two-factor&#8221; or &#8220;strong authentication&#8221; mechanism is based on one-time passwords (OTP). In this mechanism, instead of authenticating with a simple password, every user will use an OTP, generated from a device (hardware token), or by an application, perhaps on their cellphone. This is, no doubt, more secure than a static password, because the attacker needs to know both the PIN, and possess the token/device you are using. If the attackers try eavesdropping on your login session too, they won&#8217;t succeed, since a one-time password is valid for only one session. Once an OTP is generated, it cannot be reused.</p><p>One of the biggest issues with two-factor authentication is expense, because special-purpose hardware tokens have a cost &#8212; and also, the authentication server has license costs. Besides, the algorithm used to produce the codes is only known to the company &#8212; i.e., it is proprietary. The solution I&#8217;m proposing is open source, and the hardware token will be replaced by your cellphone.</p><p>In my current assignment, I had to come up with a solution that would support OTP for applications like RADIUS, SSH, Apache, and some other Web services as well.</p><p>Out of personal interest, I had in the past, used open source tools like OPIE (One-time Passwords In Everything), Mobile-OTP, Google Authenticator, etc., but the problem with these is that the secret and passphrase are stored in plain text files on the desktop filesystem. There are no schema available to integrate these applications with OpenLDAP or any directory service.</p><p>I also had to invest a lot of time and effort on scalability, service uptime, and plugins for different applications. I was looking for something that could store everything centralised in a directory server like OpenLDAP, and also was very scalable and highly available. After a bit of searching, I found a couple of open source enterprise product candidates. After some testing, I approved of OpenOTP.</p><div class="note"><strong>Note:</strong> Briefly, RADIUS (Remote Authentication Dial In User Service) is a client-server protocol for AAA (Authentication, Authorisation and Accounting) for applications such as network access or IP mobility. Intended to work in both local and roaming situations, it allows a company to maintain centralised user profiles that all remote servers can share. The RADIUS API interfaces with VPN servers and many other software applications requiring end-user authentication. For more information, please refer to the <a href="http://en.wikipedia.org/wiki/RADIUS">Wikipedia article on RADIUS</a>.</div><p>An advantage of OpenOTP is that we can use cellphones as our token device, which reduces the solution cost, since we don&#8217;t need to buy hardware tokens (though this product supports those as well). Also, it&#8217;s certified on the Open Authentication Framework (OATH). OpenOTP supports OATH HOTP (event-based), TOTP (time-based) and OCRA (challenge-based) standards for both software and hardware tokens. Many OATH-compliant software tokens are available for Android, iPhone, J2ME cellphones, Windows Mobile, Palm, BlackBerry, etc.</p><h2>Overview</h2><p>OpenOTP is an enterprise-grade two-factor authentication solution based on open standards and technologies. It provides multiple authentication methods for LDAP users, which rely on OTP, including Mobile-OTP software tokens, SMS OTP, Secure Mail OTP and YubiKey. It is completely free for up to 25 users. If you need more users, then you have to buy a licence. To learn more, please visit the <a href="http://rcdevs.com/products/openotp/">official website</a>.</p><p>The OpenOTP solution is composed of the WebADM server application, the OpenOTP SOAP service, the optional RADIUS Bridge, User Self-service Desk, and the end-user Web application. The main components in the solution are:</p><ul><li>WebADM, Web services (e.g., OpenOTP), Web apps (e.g., SelfService)</li><li>The LDAP server</li><li>RADIUS Bridge</li><li>PAM Bridge</li></ul><p>The WebADM server contains:</p><ul><li>The SOAP APIs for the installed Web services</li><li>The Web apps</li><li>The admin portal</li><li>The PKI server</li><li>The session server</li></ul><p>This article will not cover all these components; for a better idea of each component, please have a look at the product website. We will cover installation and configuration of OpenOTP, and how to configure some applications like SSH and RADIUS Bridge. Figure 1 shows the interaction of the components.</p><div id="attachment_6475" class="wp-caption aligncenter" style="width: 590px"><img class="size-large wp-image-6475" title="The suite components" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-1-590x611.png?d9c344" alt="The suite components" width="590" height="611" /><p class="wp-caption-text">Figure 1: The suite components</p></div><p>The current version of WebADM supports any 32-bit or 64-bit Linux with GLIBC &gt;=2.5 and installed 32-bit binaries. The installation package contains the required dependencies, so you don&#8217;t need to install anything extra. However, WebADM needs an LDAP server like OpenLDAP, and for logging, an SQL database (MySQL or PostgreSQL). I am using OpenLDAP and MySQL. This product can run both on a physical machine, or on a virtual machine. For the hardware requirements, please check the product website.</p><p>Figure 2 shows (at a high level) an overview of how OpenOTP might be integrated into your infrastructure.</p><div id="attachment_6476" class="wp-caption aligncenter" style="width: 451px"><img class="size-full wp-image-6476" title="Integrating OpenOTP in your environment" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-2.jpg?d9c344" alt="Integrating OpenOTP in your environment" width="451" height="283" /><p class="wp-caption-text">Figure 2: Integrating OpenOTP in your environment</p></div><h2>Installing the product</h2><p>Download the tarball from the <a href="http://www.rcdevs.com/downloads/">product website</a>, uncompress it, and run it, as follows:</p><pre class="brush: text; gutter: false">gunzip webadm-all-in-one-1.1.x.sh.gz
sh webadm-all-in-one-1.1.x.sh</pre><p>For a basic installation, just keep hitting Enter till the installation is over. My installation directory is <code>/opt/webadm</code>. This script creates the WebADM system user, sets filesystem permissions, creates directories for configuration files, logs, etc.</p><h2>Configuring OpenLDAP</h2><p>The steps below are if you are setting up a new LDAP server. If you already have an existing OpenLDAP installation, then edit the configuration files <code>/opt/webadm/conf/webadm.conf</code> and <code>/opt/webadm/conf/servers.xml</code> to make the necessary changes. These files are self-explanatory and well-documented, but you can scan the procedure below as well.</p><p>Make sure that OpenLDAP related packages are installed, using your distribution&#8217;s package manager. Copy the <em>WebADM</em> schema to the existing schema directory, and add this schema to the <code>/etc/openldap/slapd.conf</code> file:</p><pre class="brush: text; gutter: false">cp /opt/webadm/doc/OpenLDAP.schema /etc/openldap/schema/webadm.schema

include /etc/openldap/schema/webadm.schema</pre><p>Now we have to modify our suffix and <code>rootdn</code>, and also add ACLs for the webadm user. You could instead use the default LDAP user for webadm too, but it&#8217;s not recommended, for security reasons. Here, I&#8217;m using <code>example.com</code> as my DC:</p><pre class="brush: text; gutter: false">Suffix 	&quot;dc=example,dc=com&quot;
Rootdn	&quot;cn=Manager,dc=example,dc=com&quot;</pre><p>Add admin ACLs for the WebADM user (read and write permission to the entire LDAP tree) in <code>slapd.conf</code>:</p><pre class="brush: text; gutter: false">Access to *
by dn=&quot;cn=admin, dc=example, dc=com&quot; write
by self write</pre><p>Now, we add the domain to the OpenLDAP tree. Create an LDIF file, with your favourite editor, and save it as <code>example.ldif</code>, with these contents (modify them to suit your domain):</p><pre class="brush: text; gutter: false">dn : dc=example,dc=com
dc: example
ou: rootObject
objectClass: top
objectClass: dcObject
objectClass: organizationalUnit
dn: cn=admin,dc=example,dc=com
cn: admin
sn: admin
objectClass: person
objectClass: inetOrgPerson</pre><p>Initialise the OpenLDAP directory by adding the just-created LDIF:</p><pre class="brush: text; gutter: false"># slapadd –v –l example.ldif</pre><div class="note"><strong>Note:</strong> If you have an existing directory, then use <code>ldapadd</code> to add this admin user instead of <code>slapadd</code>.</div><p>Finally, restart OpenLDAP with <code>/etc/init.d/ldap restart</code>.</p><h2>Configuring MySQL</h2><p>We must create a webadm database to store audit logs and localised messages, and a webadm user with a password of our choice, with full permissions on that database. My example uses the username <em>webadm</em> and the password <em>password</em>. Make sure the MySQL service is running; log in with the client, as root; create the <em>webadm</em> database, and assign permissions, as follows:</p><pre class="brush: text; gutter: false">mysql –u root –p
mysql&gt; create database webadm;
GRANT ALL ON *.* TO webadm@”localhost” identified by ‘password’;</pre><h2>Configuring WebADM</h2><p>Let&#8217;s then configure WebADM to use our OpenLDAP and MySQL servers. All the configuration files are in <code>/opt/webadm/conf</code>. Edit <code>server.xml</code> and change the following, customised according to your setup:</p><pre class="brush: text; gutter: false">&lt;LdapServer name=&quot;LDAP Server&quot;
host=&quot;localhost&quot;
port=&quot;389&quot;
encryption=&quot;NONE&quot;
cert_file=&quot;&quot;
key_file=&quot;&quot;
/&gt;
&lt;SqlServer name=&quot;SQL Server&quot;
type=&quot;MySQL&quot;
host=&quot;localhost&quot;
port=&quot;3306&quot;
user=&quot;webadm&quot;
password=&quot;password&quot;
database=&quot;webadm&quot;
/&gt;</pre><div class="note"><strong>Note:</strong> For testing purposes, I have configured OpenLDAP without encryption. In a production environment, it&#8217;s recommended that you should use TLS &#8212; in that case, the port would be 636, and the encryption would be TLS.</div><p>Now we come to WebADM&#8217;s main configuration file, <code>webadm.conf</code>. Most of the settings work out-of-the-box with any supported LDAP backend, and with very minor changes. The file itself is very well documented so please read the comments before making changes. We need to change the LDAP tree base (suffix) in the following settings (adapting the domain name to your domain):</p><pre class="brush: text; gutter: false">auth_mode DN
list_domain yes
proxy_user	       &quot;cn=webadm,dc=example,dc=com&quot;
proxy_password         &quot;testing123&quot;
super_admins           &quot;cn=admin,dc=example,dc=com”
optionsets_container   &quot;dc=OptionSets,dc=example,dc=com&quot;
webapps_container      &quot;dc= webApps,dc=example,dc=com&quot;
websrvs_container      &quot;dc= WebSrvs,dc=example,dc=com&quot;
mountpoints_container  &quot;dc=MountPoints, dc=example,dc=com&quot;
domains_container      &quot;dc=Domains, dc=example,dc=com&quot;
clients_container      &quot;dc=Clients, dc=example,dc=com&quot;</pre><p>Now we are ready to start the <code>webadm</code> service. If you want to change the port it listens on, you can modify <code>/opt/webadm/bin/webadm</code>. By default, the Web server listens on port 443 (SSL), and the SOAP server on ports 8080 and 8443 (SSL). The settings are <code>HTTP_PORT</code>, <code>SOAP_PORT_SSL</code>, etc. To start the service, run:</p><pre class="brush: text; gutter: false">#/opt/webadm/bin/webadm start</pre><p>Navigate to WebADM (<code>https://&lt;your-server-address&gt;</code>). Only the user(s) given as <code>super_admins</code> in <code>webadm.conf</code> can run the graphical setup. So, log in with your admin account and run the graphical setup via the <em>Setup</em> button that appears on the home page.</p><p>WebADM requires a DN-based login until the setup is completed. Then it will use the login mode as configured in <code>webadm.conf</code>. The graphical setup process will:</p><ul><li>Create the required database tables (as specified in <code>conf/database.xml</code>).</li><li>Register the required LDAP schema <em>objectclasses</em> and attributes.</li><li>Create the proxy user (if it does not already exist).</li><li>Create the WebADM LDAP containers (as defined in <code>conf/webadm.conf</code>).</li></ul><p>This article will not describe in detail how to use the WebADM GUI &#8212; for that, take a look at the WebADM manual. This GUI is the centralised point for LDAP and OpenOTP administration activities like creation, deletion, modification, etc.</p><div class="note"><strong>Note:</strong> In my test setup, I&#8217;m using a single machine as the OpenOTP, OpenLDAP and RADIUS Bridge server, but for a production environment, it&#8217;s suggested that you use separate servers for each service.</div><p>Once you log in to the console, you can see that some domains have already been created, like <code>dc=clients,dc=MountPoints,dc=ObjectSets,dc=WebApps,dc=WebSrvs</code>, etc. These are created by the setup script for use by WebADM.</p><h2>Test user</h2><p>Now we have to create a user for our test setup. For this, let&#8217;s create a different OU called <em>People</em>. Once the OU is created, you can see it in the left pane. To create the WebADM user, follow the steps shown below:</p><ol><li>Click <em>Create</em>, and you will see the screen shown in Figure 3.<div id="attachment_6478" class="wp-caption aligncenter" style="width: 505px"><img class="size-full wp-image-6478" title="WebADM Account" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-3.png?d9c344" alt="WebADM Account" width="505" height="420" /><p class="wp-caption-text">Figure 3: WebADM Account</p></div></li><li>Select <em>WebADM Account</em> and click <em>Proceed</em>. Provide all necessary information, like CN, Last Name, Login Name, password, etc. Then click <em>Proceed</em> and click <em>Create the object</em>.</li><li>After creating <em>testuser</em>, Figure 4 is the screen you will see.<div id="attachment_6479" class="wp-caption aligncenter" style="width: 590px"><a href="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-4.png?d9c344"><img class="size-large wp-image-6479" title="OpenOTP setting" src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-4-590x250.png?d9c344" alt="OpenOTP setting" width="590" height="250" /></a><p class="wp-caption-text">Figure 4: OpenOTP setting</p></div></li><li>Now we change OpenOTP settings like Token, PIN, etc. Click the <em>Application</em> menu, select OTP Authentication Server and click <em>Configure</em>. You will see the screen shown in Figure 5.<div id="attachment_6480" class="wp-caption aligncenter" style="width: 374px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-5.png?d9c344" alt="Configuration" title="Configuration" width="374" height="635" class="size-full wp-image-6480" /><p class="wp-caption-text">Figure 5: Configuration</p></div></li><li>Now configure the OpenOTP application as per your needs, like the default OpenOTP authentication mode, domain name, host-name of your server, etc. The basic setting is <em>Login Mode</em> (authentication mode). I used LDAPOTP, to require both LDAP and OTP passwords, which is the default. If you enable <em>Password Swapping</em>, it will accept either LDAP or OTP.</li><li>Now click <em>Proceed</em>, then click <em>testuser</em> and click <em>OTP  Server</em>. You will see the screen shown in Figure 6.<div id="attachment_6481" class="wp-caption aligncenter" style="width: 325px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-6.png?d9c344" alt="OTP Authentication server" title="OTP Authentication server" width="325" height="437" class="size-full wp-image-6481" /><p class="wp-caption-text">Figure 6: OTP Authentication server</p></div></li><li>Select <em>Register/Unregister Token</em>; you will see the screen shown in Figure 7.<div id="attachment_6482" class="wp-caption aligncenter" style="width: 389px"><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/openotp-7.png?d9c344" alt="Token registration" title="Token registration" width="389" height="352" class="size-full wp-image-6482" /><p class="wp-caption-text">Figure 7: Token registration</p></div></li><li>Select Mobile OTP (Time-Based). If you have an existing key, you can put it in the Token Key field, or you can let the server generate a key.</li><li>Then you enter your Token PIN, click <em>Register</em>, and you are done.</li></ol><p>So now our test user is ready to use Mobile-OTP. You can download the relevant application from your Apps store. (I&#8217;m using &#8220;Droid OTP&#8221; for my Android device.) Launch it, and enter your secret PIN to generate the passwords you can use to log in to different applications. Next, let us look into how to configure applications like SSH and RADIUS.</p><h2>Configuring SSHD for OTP passwords</h2><p>Download <code>libopenotp-1.0.4-1.tgz</code> and <code>pam_openotp-1.0.4.tar.gz</code> from <a href="http://www.rcdevs.com/downloads/">the downloads section on RCDevs website</a> and decompress them. For 32-bit architectures, the default modules are present in the <code>build_linux32</code> subdirectory of the extracted <code>libopenotp</code> tar, but for 64-bit, you have to compile it. For my 64-bit setup, I compiled and installed <code>libopenotp</code> with <code>make &amp;&amp; make install</code>. I then moved <code>/usr/local/lib/libopenotp*</code> to <code>/usr/lib64</code>.</p><p>After getting <code>libopenotp</code> into the appropriate directory, run an <code>ldconfig</code>.</p><p>Next, compile <code>pam_otp</code> with <code>make</code>. Copy <code>pam_openotp.so</code> to the architecture-specific <code>security</code> directory: for 64-bit, <code>/lib64/security/</code> and for 32-bit, <code>/lib/security</code>. On 64-bit, remove the <code>pam</code> module from <code>/lib/security/</code>.</p><p>Edit <code>/etc/pam.d/sshd</code> and replace the line &#8220;auth include system-auth&#8221; with the following, replacing <code>myserver</code> with the WebADM server&#8217;s IP address:</p><pre class="brush: text; gutter: false">auth required pam_openotp.so server_url=&quot;http://myserver:8080/openotp/&quot; client_id=&quot;SSH&quot;</pre><p>My file now looks like this:</p><pre class="brush: text; gutter: false">auth    required 	pam_env.so
auth   required	pam_openotp.so server_url=http://192.168.0.1:8888/openotp/ client_id=&quot;SSH&quot; password_mode=2, default_domain=&quot;example&quot;</pre><div class="note"><strong>Note:</strong> Read the <code>README</code> file in your OpenOTP PAM module distribution for configuration details.</div><p>Next, let&#8217;s configure the OpenSSH service. Edit <code>/etc/ssh/sshd_config</code>. Enable OpenSSH challenge response mode with <code>ChallengeResponseAuthentication yes</code>. Enable OpenSSH password authentication with <code>PasswordAuthentication yes</code>. Enable OpenSSH with PAM with <code>UsePAM yes</code>. Save and exit. Restart the SSH service.</p><p>Now if you try to connect as the test user (for example, <code>ssh testuser@192.168.0.1</code>) from any box, it will prompt you for an OTP password, and not the normal password.</p><h2>RADIUS Bridge (RB)</h2><p>OpenOTP RADIUS Bridge provides the RADIUS API for OpenOTP. It is an optional server component to be deployed on your OpenOTP installation and is implemented over the open source FreeRADIUS software.</p><h3>Installation and configuration</h3><p>Download RADIUS Bridge from <a href="http://www.rcdevs.com/downloads/">the downloads section on RCDevs website</a> and install it using the self-installer script (for example, <code>sh radiusd.1.0.6-1.sh</code>). The installation creates the RADIUS Bridge system user and sets filesystem permissions. Edit <code>/opt/radiusd/conf/openotp.conf</code> and change the following parameters, adapting them to your environment:</p><pre class="brush: text; gutter: false">Server_url = http://192.168.0.1:8080/openotp/
Password_mode = 2
Default_domain = &quot;example&quot;
Data_is_vps = yes</pre><p>For more information regarding the settings, please look at the <code>README</code> file.</p><p>Start the radius service with <code>/opt/radiusd/bin/radius restart</code>. If required, add your RADIUS network access clients (for example, your VPN server IP address) in <code>/opt/radiusd/conf/clients.conf</code>. Each client must be configured with an IP address and a RADIUS secret. By default, RADIUS Bridge accepts requests from any client using the RADIUS secret &#8220;testing123&#8243;. If you want the RADIUS server to reply with a value-attribute pair, make sure all the attribute and value pairs exist in the <code>/opt/radiusd/lib/dictionaries/dictionary.XXX</code> file, and specify the same in the <code>Reply-Data</code> section of the user (in the WebADM GUI console) as follows:</p><pre class="brush: text; gutter: false">192.168.0.1:Vendor-XXX-Profile-ID=2000,192.168.0.2:Vendor-XXX-Profile-ID=3000</pre><p>This means that if testuser logs in from 192.68.0.1, the network access client will get a value of 2000, while if the person logs in from 192.168.0.2. it will get a value of 3000.</p><div class="note"><strong>Note:</strong> The RADIUS Attribute Value Pairs (AVP) carry data in both the request and the response for the authentication, authorisation, and accounting transactions.</div><p>We are done!</p><p>OpenOTP is pretty vast, and everything can&#8217;t be covered in a single article. We covered the basic setup and configuration. For other services, please check the documentation available at the website. This product is scalable and you can also configure the services in HA mode.</p><p>If you want to go ahead with two-factor authentication, and don&#8217;t want to invest, then you can also check OPIE, Google Authenticator, etc.<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/12/exploring-software-plone-with-schemas/" rel="bookmark" class="crp_title">Exploring Software: Plone with Schemas</a></li><li><a href="http://www.linuxforu.com/2011/10/lets-play-with-codeigniter/" rel="bookmark" class="crp_title">Let&#8217;s Play with CodeIgniter</a></li><li><a href="http://www.linuxforu.com/2011/05/drupal-module-development-quick-start-practical-guide/" rel="bookmark" class="crp_title">A Quick-Start Practical Guide to Drupal Module Development</a></li><li><a href="http://www.linuxforu.com/2011/12/loading-library-files-in-cpp/" rel="bookmark" class="crp_title">Loading Library Files in C++</a></li><li><a href="http://www.linuxforu.com/2011/12/setting-up-a-lamp-server-remotely/" rel="bookmark" class="crp_title">Setting up a LAMP Server Remotely</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/2-factor-authentication/" title="2-factor authentication" rel="tag">2-factor authentication</a>, <a href="http://www.linuxforu.com/tag/android/" title="Android" rel="tag">Android</a>, <a href="http://www.linuxforu.com/tag/auth-server/" title="auth server" rel="tag">auth server</a>, <a href="http://www.linuxforu.com/tag/authentication-server/" title="authentication server" rel="tag">authentication server</a>, <a href="http://www.linuxforu.com/tag/blackberry/" title="blackberry" rel="tag">blackberry</a>, <a href="http://www.linuxforu.com/tag/directory-service/" title="directory service" rel="tag">directory service</a>, <a href="http://www.linuxforu.com/tag/google/" title="Google" rel="tag">Google</a>, <a href="http://www.linuxforu.com/tag/ldap/" title="LDAP" rel="tag">LDAP</a>, <a href="http://www.linuxforu.com/tag/lfy-august-2011/" title="LFY August 2011" rel="tag">LFY August 2011</a>, <a href="http://www.linuxforu.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.linuxforu.com/tag/openldap/" title="OpenLDAP" rel="tag">OpenLDAP</a>, <a href="http://www.linuxforu.com/tag/openotp/" title="OpenOTP" rel="tag">OpenOTP</a>, <a href="http://www.linuxforu.com/tag/otp/" title="OTP" rel="tag">OTP</a>, <a href="http://www.linuxforu.com/tag/radius/" title="RADIUS" rel="tag">RADIUS</a>, <a href="http://www.linuxforu.com/tag/rcdevs/" title="RCDevs" rel="tag">RCDevs</a>, <a href="http://www.linuxforu.com/tag/time-passwords/" title="time passwords" rel="tag">time passwords</a>, <a href="http://www.linuxforu.com/tag/virtual-machine/" title="virtual machine" rel="tag">virtual machine</a>, <a href="http://www.linuxforu.com/tag/webadm/" title="WebADM" rel="tag">WebADM</a>, <a href="http://www.linuxforu.com/tag/windows-mobile/" title="Windows Mobile" rel="tag">Windows Mobile</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/08/setip-two-factor-authentication-using-openotp/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Comprehensive LAMP Guide &#8212; Part 2 (MySQL)</title><link>http://www.linuxforu.com/2011/08/comprehensive-lamp-guide-part-2-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comprehensive-lamp-guide-part-2-mysql</link> <comments>http://www.linuxforu.com/2011/08/comprehensive-lamp-guide-part-2-mysql/#comments</comments> <pubDate>Sun, 31 Jul 2011 18:35:35 +0000</pubDate> <dc:creator>Nilesh Govindarajan</dc:creator> <category><![CDATA[How-Tos]]></category> <category><![CDATA[Servers]]></category> <category><![CDATA[Sysadmins]]></category> <category><![CDATA[bottleneck]]></category> <category><![CDATA[CPU cache]]></category> <category><![CDATA[database]]></category> <category><![CDATA[GCC]]></category> <category><![CDATA[InnoDB]]></category> <category><![CDATA[LAMP]]></category> <category><![CDATA[LFY August 2011]]></category> <category><![CDATA[maximum performance]]></category> <category><![CDATA[MyISAM]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[mysql server]]></category> <category><![CDATA[phpMyAdmin]]></category> <category><![CDATA[RDBMS]]></category> <category><![CDATA[relational database management]]></category> <category><![CDATA[relational database management system]]></category> <category><![CDATA[security holes]]></category> <category><![CDATA[web applications]]></category><guid isPermaLink="false">http://www.linuxforu.com/?p=6411</guid> <description><![CDATA[MySQL is the most widely used Relational Database Management System (RDBMS), and is the &#8220;M&#8221; in the LAMP stack. One of the main uses for MySQL is with Web applications. To avoid the...]]></description> <content:encoded><![CDATA[<p><img src="http://cdn.linuxforu.com/wp-content/uploads/2011/08/lamp-mysql-590x358.jpg?d9c344" alt="Comprehensive LAMP guide" title="Comprehensive LAMP guide" width="590" height="358" class="aligncenter size-large wp-image-6416" /><div class="introduction">MySQL is the most widely used Relational Database Management System (RDBMS), and is the &#8220;M&#8221; in the LAMP stack. One of the main uses for MySQL is with Web applications. To avoid the database turning into the bottleneck in Web applications, let us set up a MySQL server and tune it for maximum performance. At the time of writing, the latest (stable) version of MySQL is 5.5.14, and we&#8217;ll be using that here.</div><p>Though MySQL provides binaries for various Linux distributions and even FreeBSD, we&#8217;re not interested; we need performance, and so we&#8217;ll be compiling our own. As in the previous article, I do not claim that optimisations will definitely increase performance; sometimes, they can cause degradation as well, because it depends more on hardware, CPU cache and DRAM.</p><p>MySQL, unlike the traditional <code>./configure</code> build methods, uses CMake, an advanced and easy-to-use build system with a nice UI called <code>ccmake</code> (command-line) or <code>cmake-gui</code> (the GUI, if you run X). However, we&#8217;ll specify options at the command line itself. Along with CMake, you&#8217;ll also need a C++ compiler installed. This usually comes with GCC in most distributions, but sometimes is in a separate package (e.g., Fedora has <code>gcc</code> and <code>gcc-c++</code>).</p><p>To download the MySQL source tarball, navigate to the <a href="http://dev.mysql.com/downloads/mysql/5.5.html#downloads">downloads page on the MySQL website</a>, and in the platform drop-down list, choose &#8220;Source Code&#8221;. When the download option is displayed, make a note of the MD5 sum in a text file. After the download is over, to ensure you have the original file and not a tampered version with security holes, verify the file checksum as follows.</p><p>Copy the saved MD5 sum to the clipboard, and paste it at the shell prompt, to assign to a variable, as shown; then run the following commands:</p><pre class="brush: text; gutter: false">$ ORG_SUM=&amp;lt;Paste the MD5 sum here&amp;gt;
$ FLE_SUM=$(md5sum mysql-5.5.14.tar.gz | awk -F ' +' '{ print $1 }')
$ [ "$ORG_SUM" == "$FLE_SUM" ] &amp;amp;&amp;amp; echo verification success || echo verification failed</pre><p>If your download was not okay, redownload it, else read on.</p><h2>Source code configuration</h2><p>CMake accepts options on the command line with the <code>-D</code> switch; for example, <code>cmake -D&lt;OPTION NAME&gt;=&lt;OPTION VALUE&gt;</code>. Significant options while configuring the code-base are:</p><ul><li><code>CMAKE_INSTALL_PREFIX</code>: The location where the MySQL server will be installed.</li><li><code>COMMUNITY_BUILD</code>: Enables/disables the community features in MySQL.</li><li><code>ENABLED_PROFILING</code>: Enables/disables query profiling code.</li><li><code>MYSQL_DATADIR</code>: This is the default directory where data will be stored. It can be set in the configuration file as well, after installation.</li><li><code>WITH_INNOBASE_STORAGE_ENGINE</code>: Enables/disables InnoDB, a transactional storage engine.</li><li><code>WITH_DEBUG</code>: Enables/disables debugging capability; this increases the binary size, but can be very useful while getting support from forums, etc, in case your installation fails for some reason. A related option is <code>ENABLE_DEBUG_SYNC</code>.</li><li><code>WITH_PARTITION_STORAGE_ENGINE</code>: Enables/disables the partition storage engine.</li><li><code>WITH_SSL</code>: Enables/disables SSL support in the server and client. Enable this if you see any need for replication in the future; unencrypted replication is a risk.</li><li><code>CMAKE_CXX_FLAGS</code>: Sets the C++ compiler flags <code>-O3 -march=native -mtune=native -msse -msse2 -mmmx</code> (provided you have a CPU with a decent cache size &#8212; else use <code>-Os</code> instead of <code>-O3</code>).</li><li><code>CMAKE_C_FLAGS</code>: Sets the C compiler flags. MySQL has no C code, so this is not required. You might want to set it to the same value as <code>CXXFLAGS</code>, for sanity.</li><li><code>DISABLE_SHARED</code>: Builds MySQL statically, with all plugins compiled in. This is not preferred; it will unnecessarily consume memory for unwanted features/plugins.</li></ul><p>I have described the most important options, all of which are enabled by default. If you want a look at many more, use <code>ccmake</code> or <code>cmake-gui</code>, or refer to the MySQL documentation <a href="http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html">here</a>.</p><h2>Server configuration</h2><p>MySQL&#8217;s single configuration file, <code>my.cnf</code>, is located in <code>CMAKE_INSTALL_PREFIX/etc</code> or <code>MYSQL_DATADIR</code> (deprecated). You can also pass the location of the configuration file to <code>mysqld</code> while starting it. Some of the configuration options in <code>my.cnf</code> in the <code>[mysqld]</code> section are:</p><ul><li><code>bind-address</code>: The address on which the server will listen for connections. If you&#8217;re only going to connect from localhost, don&#8217;t use this; instead, use the <code>skip-networking</code> option, as a security measure.</li><li><code>user</code>: The account as which <code>mysqld</code> will run; again, a security measure. This user must have R/W access to <code>MYSQL_DATADIR</code>.</li><li><code>datadir</code>: By default, the compile-time path in <code>MYSQL_DATADIR</code>. Change it if you want to relocate the data directory.</li><li><code>character-set-server</code>: Keep as UTF8 (Unicode), unless you have special reason to change it.</li><li><code>character-set-client</code>: Same as the previous option, but this will tell the client to use the specified character set.</li><li><code>default-character-set</code>: The default set to use while creating tables.</li><li><code>default-storage-engine</code>: This default (MyISAM) will be used if an engine is not specified in the <code>CREATE</code> statement.</li><li><code>skip-innodb</code>: Disable the InnoDB storage engine. If you statically compiled MySQL, you need to use <code>ignore-builtin-innodb</code>.</li><li><code>key_buffer</code>: The MyISAM key buffer; should be kept as large as possible (of course, sparing DRAM for other applications and services). The larger it is, the better the performance. On a dedicated MySQL server, it is usually at least a quarter of the total memory (and not more than half). It should be enough to hold all the MyISAM indexes (<code>.MYI</code> files) in memory. This can be checked via variables, which can be obtained by the <code>SHOW VARIABLES</code> command at the MySQL command prompt, or using tools like phpMyAdmin. Obtain these variable values, and divide <code>key_read</code> by <code>key_read_requests</code>; the value should be &lt; 0.01. And if you divide <code>key_write</code> by <code>key_write_requests</code>, the value should be &lt; 1.</li><li><code>table-cache</code>: Every time MySQL opens a table, it saves it in cache, to speed up access. The variable <code>opened_tables</code> in server status will tell you what you need to set this to; some use cases have seen values as high as 20,000. Keep <code>opened_tables</code> as low as possible.</li><li><code>read_buffer_size</code>: The default is 128K, and usually this is set to 1M or 2M. The performance depends on CPU cache, disk speed and other factors; you should run a test in your environment, as described <a href="http://www.mysqlperformanceblog.com/2007/09/17/mysql-what-read_buffer_size-value-is-optimal/">here</a>.</li><li><code>query_cache_type</code>: The value 0 means the query cache is disabled; 1 implies that the query cache is enabled for all queries that don&#8217;t have <code>SQL_NO_CACHE</code> specified in the query; and 2 means that no query is cached unless <code>SQL_CACHE</code> is specified in the query.</li><li><code>query_cache_size</code>: The larger the better, but also check the available DRAM.</li><li><code>query_cache_limit</code>: The maximum size of the result set that will be stored in the query cache. This should be large if you have queries producing large result sets and have a lot of DRAM to spare. Watch the variables <code>%Qcache%</code> in the server status to see how well the query cache is being used.</li><li><code>tmp_table_size</code>: MySQL sometimes needs to create temporary tables automatically, depending on the query. When the result set grows larger than the size specified here, the temporary table is converted to a disk-based temporary table, which results in a loss in performance. Keep this size as large as possible, considering the available DRAM and other applications running on the site. In the server status, observe <code>created_tmp_disk_tables</code>.</li><li><code>max-connections</code>: The maximum number of simultaneous connections. This is limited by CPU power and the available DRAM.</li><li><code>sort_buffer</code>: This should be set to a high value if your queries involve a lot of sorting. This seems to have some negative effect on performance as well, so do a few test cases before and after changing the value.</li><li><code>thread_cache</code>: If you have a lot of very-short-duration connections, increase this value till the <code>hreads_created</code> value stops increasing in the server status, to reduce CPU usage.</li><li><code>long_query_time</code>: This is the time a query will be allowed to run before it is considered slow and logged in slowlog. Keep this value small &#8212; say 5s; the default value is 10s.</li><li><code>slow_query_log_file</code>: This is the path to the slow query log file. MySQL 5.5 has a new option, <code>log-queries-not-using-indexes</code>. If specified, it will send only slow queries that are not using indexes to the slow query log.</li></ul><h2>Tips for designing efficient tables and queries</h2><p>Although I have talked a lot about options and optimisations, the actual optimisation of MySQL is done by properly designing tables and the database. Also, it depends on how efficient your queries are. Generally, one query can be executed in multiple ways, and each way has its own advantages and disadvantages. We need to choose a query that suits our environment and isn&#8217;t costly on the performance side. Here are some points:</p><ul><li>Keep the design simple; split your columns across tables. Columns you don&#8217;t access often should be put in a different table, to avoid memory wastage when the table is cached. You can link data across tables using foreign keys, which are supported only in InnoDB, and not in MyISAM.</li><li>Use MyISAM if you are going to read a lot and write less &#8212; and InnoDB otherwise. There are some absolutely astounding results in this aspect, and you should switch engines after proper testing.</li><li>The columns frequently used in <code>WHERE</code> statements and in filtering results should be indexed. Indexes point to the data location on the disk. If indexes are not used, MySQL has to scan the whole table to find the required row, which is very costly in terms of performance.</li><li>Your tables should conform to normal form rules, have normalised data, and use efficient column types.</li><li>Keep queries simple and short. Longer queries take more time to execute. Use application-level caching.</li><li>Turn on slow query logging in <code>my.cnf</code> by setting <code>long_query_time</code> and <code>slow_query_log_file</code>.</li><li>Use <code>EXPLAIN</code> and <code>ANALYZE</code> to see what a slow query does, and how long it takes. This can give you a lot of hints for optimising it.</li><li>Run <code>OPTMIZE TABLE</code> frequently. But be aware: this locks the table, so run it only when MySQL traffic is low. This basically rearranges disk files, reclaiming disk space consumed by deleted rows.</li></ul><p>Since MySQL uses a lot of disk, actual performance is pretty much limited by disk performance, rotation speed, etc. Obviously, you need a high-speed disk. Another optimisation tip would be to use a filesystem that supports compression on the MySQL data partition, to reduce disk seeks; this is currently supported in ZFS (FreeBSD) and Btrfs. The latter is under development as of now, and not recommended for production use; try it only after proper backups.</p><p>Using RAID striping with a stripe size of 1 MB or so can help a lot, since the data is split across two disks, and reading from two disks is obviously faster than reading from one disk sequentially.</p><p>There&#8217;s another possibility for speeding up disk performance, which is not actually tested: using SquashFS and AUFS. I have never tried it for a MySQL database directory but have used it on my system, and it does speed up things at the cost of CPU usage. What you basically do is compress <code>/usr</code> into a squashfs file &#8212; say, <code>/squashed/usr.sqfs</code>. Then, you mount <code>usr.sqfs</code> at <code>/squashed/usr/ro (loop, readonly)</code>.</p><p>Using AUFS, you can mount <code>/usr</code> and specify read (<code>/squashed/usr/ro</code>) and write (<code>/squashed/usr/rw</code>) locations as its branches. The only problem with this method is that you have to re-squash whenever large changes are made, in order to ensure performance. This is probably not feasible with MySQL in cases where the database will have a lot of writes.</p><p>More information on this squashing method can be obtained from this <a href="http://forums.gentoo.org/viewtopic-t-646289-postdays-0-postorder-asc-start-0.html">Gentoo Linux forum thread</a>. Please note that I&#8217;m not responsible for any loss. Backup before trying any tricks. :-)<div id="crp_related"><h5>Related Posts:</h5><ul><li><a href="http://www.linuxforu.com/2011/08/connecting-to-mysql-with-python-and-php/" rel="bookmark" class="crp_title">Connecting to MySQL With Python and PHP</a></li><li><a href="http://www.linuxforu.com/2009/03/joy-of-programming-how-to-detect-integer-overflow/" rel="bookmark" class="crp_title">Joy of Programming: How to Detect Integer Overflow</a></li><li><a href="http://www.linuxforu.com/2011/10/lets-play-with-codeigniter/" rel="bookmark" class="crp_title">Let&#8217;s Play with CodeIgniter</a></li><li><a href="http://www.linuxforu.com/2011/09/comprehensive-lamp-guide-part-3-php/" rel="bookmark" class="crp_title">The Comprehensive LAMP Guide &#8212; Part 3 (PHP)</a></li><li><a href="http://www.linuxforu.com/2009/05/database-programming-in-python/" rel="bookmark" class="crp_title">Database Programming in Python</a></li></ul></div>Tags: <a href="http://www.linuxforu.com/tag/bottleneck/" title="bottleneck" rel="tag">bottleneck</a>, <a href="http://www.linuxforu.com/tag/cpu-cache/" title="CPU cache" rel="tag">CPU cache</a>, <a href="http://www.linuxforu.com/tag/database/" title="database" rel="tag">database</a>, <a href="http://www.linuxforu.com/tag/gcc/" title="GCC" rel="tag">GCC</a>, <a href="http://www.linuxforu.com/tag/innodb/" title="InnoDB" rel="tag">InnoDB</a>, <a href="http://www.linuxforu.com/tag/lamp/" title="LAMP" rel="tag">LAMP</a>, <a href="http://www.linuxforu.com/tag/lfy-august-2011/" title="LFY August 2011" rel="tag">LFY August 2011</a>, <a href="http://www.linuxforu.com/tag/maximum-performance/" title="maximum performance" rel="tag">maximum performance</a>, <a href="http://www.linuxforu.com/tag/myisam/" title="MyISAM" rel="tag">MyISAM</a>, <a href="http://www.linuxforu.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.linuxforu.com/tag/mysql-server/" title="mysql server" rel="tag">mysql server</a>, <a href="http://www.linuxforu.com/tag/phpmyadmin/" title="phpMyAdmin" rel="tag">phpMyAdmin</a>, <a href="http://www.linuxforu.com/tag/rdbms/" title="RDBMS" rel="tag">RDBMS</a>, <a href="http://www.linuxforu.com/tag/relational-database-management/" title="relational database management" rel="tag">relational database management</a>, <a href="http://www.linuxforu.com/tag/relational-database-management-system/" title="relational database management system" rel="tag">relational database management system</a>, <a href="http://www.linuxforu.com/tag/security-holes/" title="security holes" rel="tag">security holes</a>, <a href="http://www.linuxforu.com/tag/web-applications/" title="web applications" rel="tag">web applications</a><br /> ]]></content:encoded> <wfw:commentRss>http://www.linuxforu.com/2011/08/comprehensive-lamp-guide-part-2-mysql/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Content Delivery Network via cdn.linuxforu.com

Served from: www.linuxforu.com @ 2012-02-08 10:33:31 -->
