<?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>Zen Dzign &#187; Debian</title>
	<atom:link href="http://www.zendzign.com/category/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zendzign.com</link>
	<description>The official ZZ Servers Blog - Visit http://www.zzservers.com for your business hosting needs.</description>
	<lastBuildDate>Thu, 26 Jan 2012 05:59:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Server cabinet door alarm</title>
		<link>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/</link>
		<comments>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 03:08:38 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[physical security]]></category>
		<category><![CDATA[teensy]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=220</guid>
		<description><![CDATA[The first step in securing servers is to ensure that they are physically as secure as possible and and then monitored for unauthorized access  Many times when setting up servers in a small office or co-location facility many people have their systems in a locking cabinet within a moderately secured physical building.  However a determined [...]]]></description>
			<content:encoded><![CDATA[<p>The first step in securing servers is to ensure that they are physically as secure as possible and and then monitored for unauthorized access  Many times when setting up servers in a small office or co-location facility many people have their systems in a locking cabinet within a moderately secured physical building.  However a <a title="Tiger Team" href="http://video.google.com/videoplay?docid=5642547759793319840">determined attacker</a> can usually bypass many physical controls so adding as many layers and monitoring helps can help both to thwart an attacker or be used to monitor for authorized equipment access through change management filtering on your <a title="Zabbix Maintenance Mode" href="http://www.zabbix.com/documentation/1.8/manual/maintenance_mode_for_gui">monitoring and alerting system</a>.</p>
<p><span id="more-220"></span>One problem with the small office or colo environment is there are very few affordable solutions that can be used to monitor for authorized and unauthorized access.  To solve this problem, ZZ Servers has implemented a cabinet monitoring solution that is able to not only monitor for cabinet door entry but also has the ability to have temperature and humidity sensors (which we do not actually do in this initial proof of concept).</p>
<p>The cabinet door alarm is based on a <a title="PJRC Teensy" href="http://pjrc.com/store/teensy.html">teensy 2.0</a> USB device that uses digital inputs to determine if magnetic alarm door switches are open or closed and then monitor their status with any standard monitoring system through a USB connection to the Teensy device. The teensy can be ordered from <a title="PJRC Teensy" href="http://pjrc.com/store/teensy.html">PJRC</a> for $16. The LED, Resistor and remaining components can be purchased from <a title="Jameco" href="http://www.jameco.com">Jameco</a>, Amazon, Home Depot, Radio Shack or any other similar store.</p>
<p>The teensy is connected through USB to a linux server in the cabinet that runs an application to query the status of each sensor. The teensy provides a +5V pin that will be connected to a 10k ohm resistor which is then connected to the GND with one connection to each of 4 input pins for the door sensor and an LED connected to interface 11.</p>
<p><a href="http://www.zendzign.com/wp-content/uploads/2012/01/zz-cabinetalarm.jpg"><img class="alignnone size-full wp-image-221" title="zz-cabinetalarm-teensy-layout" src="http://www.zendzign.com/wp-content/uploads/2012/01/zz-cabinetalarm.jpg" alt="ZZ Servers Homebrew Teensy Cabinet Alarm Layout" width="225" height="227" /></a></p>
<p>The current design is for only 4 alarm switches; but there is no reason the other inputs can&#8217;t be used. If additional inputs are used then the associated firmware and software programs will need to be updated to reflect the number of interfaces.</p>
<p>This design also expects there to be a closed circuit on all monitored ports otherwise an alarm will be raised. A simple closed loop will work for any alarm switches not installed.</p>
<p>Once the circuit is assembled the firmware needs to be uploaded to the teensy. The firmware used is based on the arduino support for Teensy that can be <a title="Teensy Development Download" href="http://pjrc.com/teensy/td_download.html">downloaded</a>.  The steps to setup the Teensy/Arduino development environment are found on the page and need to be followed to allow for proper aduino sketch to be built and loaded onto the teensy flash.</p>
<ul>
<li><a>Extract Arduino Software</a></li>
<li>Install <a title="Teensy UDEV Rules" href="http://pjrc.com/teensy/49-teensy.rules">49-teensy.rules</a> in /etc/udev/rules.d (see below for contents of this file)</li>
<li><a title="Teensy Duino Download" href="http://www.pjrc.com/teensy/td_download.html">Download</a> &amp; Run teensy duino installer. Examples/samples are not needed unless doing future development</li>
</ul>
<p>Once the development tools are installed:</p>
<ul>
<li>Start the arduino IDE (found in arduino software extract)</li>
<li>Connect the teensy usb interface</li>
<li>Set board type to Teensy 2.0 (Tools/Board/Teensy 2.0)</li>
<li>Load the code (below)</li>
<li>Verify (checkbox in IDE) the code</li>
<li>Upload (right arrow in IDE) the HEX firmware</li>
</ul>
<p><strong>Teensy Firmware:</strong><br />
The firmware has 3 main sections; the Header where the various variables are defined that are used within the program, The setup function which runs when the teensy is powered on (plugged into USB) and then the loop which is executed after setup executing the designed function.</p>
<p>When the teensy boots, it load the setup function which initializes the device allowing for INPUT_PULLUP functionality for the 4 pins used for the alarm. This creates the alert when the switch is opened. The setup then initializes the USB serial device at 38400 8n1 and configures the LED output PIN and makes sure the LED is off.</p>
<p>The loop function is the core of the firmware. This is the function that the teensy executes over and over. In this function the first thing to do is read each of the alarm interfaces and if there is an alert flag it so we can be sure to blink the LED. Next the loop will see if there are any requests on the serial port, which will come from the serial program further down in this post. If there is input from the serial interface, the loop confirms it is a valid request [1,2,3,4] and then prints back on the serial interface a simple message showing the status of the serial ports.</p>
<p>Finally the loop ends by running the BlinkLED function if there is an alarm otherwise if the LED is on be sure to turn it off.</p>
<p>The BlinkLED function works by using a nice variable type provided by the Teensy &#8220;elapsedMillis&#8221; which creates a timer that is used to trace the time since the variable was created. Using this variable if it has been one second (1000ms) then reset the timer and if the LED is on turn it off, otherwise turn it on.<br />
<em>zz_alarm0.ino</em></p><pre class="crayon-plain-tag"><code>// Header Section
int ledPin =&nbsp; 11;
int ledon = 0;
int ALARM_1 = 1;
int ALERT_1 = 0;
int ALARM_2 = 2;
int ALERT_2 = 0;
int ALARM_3 = 3;
int ALERT_3 = 0;
int ALARM_4 = 4;
int ALERT_4 = 0;
int alarmnow = 0;
char alarmcheck = ' ';
elapsedMillis sinceAlarm;
//End Header Section

// The setup() method runs once, when the sketch starts
void setup()&nbsp;&nbsp; {
     pinMode(ALARM_1, INPUT_PULLUP);
     pinMode(ALARM_2, INPUT_PULLUP);
     pinMode(ALARM_3, INPUT_PULLUP);
     pinMode(ALARM_4, INPUT_PULLUP);
     Serial.begin(38400);
     pinMode(ledPin, OUTPUT);
     digitalWrite(ledPin, LOW);
}

// the loop() method runs over and over again, checking for events
void loop()&nbsp;&nbsp; {
     alarmnow = 0;
     alarmcheck = ' ';

     ALERT_1 = digitalRead(ALARM_1);
     ALERT_2 = digitalRead(ALARM_2);
     ALERT_3 = digitalRead(ALARM_3);
     ALERT_4 = digitalRead(ALARM_4);

     if (ALERT_1 || ALERT_2 || ALERT_3 || ALERT_4) {
          alarmnow = 1;
     }

     if (Serial.available()) {
          alarmcheck = Serial.read();
     }

     switch (alarmcheck) {
          case '1':
               if (ALERT_1) {
                    Serial.println(&quot;1:1&quot;);
               } else {
                    Serial.println(&quot;1:0&quot;);
               }
               break;
          case '2':
               if (ALERT_2) {
                    Serial.println(&quot;2:1&quot;);
               } else {
                    Serial.println(&quot;2:0&quot;);
               }
               break;
          case '3':
               if (ALERT_3) {
                    Serial.println(&quot;3:1&quot;);
               } else {
                    Serial.println(&quot;3:0&quot;);
               }
               break;
          case '4':
               if (ALERT_4) {
                    Serial.println(&quot;4:1&quot;);
               } else {
                    Serial.println(&quot;4:0&quot;);
               }
               break;
          case ' ':
               break;
          default:
               Serial.println(&quot;X:1&quot;);
               break;
     }

     if (alarmnow) {
          BlinkLED();
     } else if (ledon) {
          digitalWrite(ledPin, LOW);
     }
}

void BlinkLED() {
     if (sinceAlarm &gt;= 1000) {
          sinceAlarm = sinceAlarm - 1000;
          if (ledon) {
               ledon = 0;
               digitalWrite(ledPin, LOW);
          } else {
               ledon = 1;
               digitalWrite(ledPin, HIGH);
          }
     }
}</code></pre><p>Once the firmware is loaded onto the teensy and all the switches are in place the linux system that will interface with the alarm needs to have a udev rule created that will allow the usbSerial interface to function.<br />
<strong>Linux UDEV rules</strong><em><br />
/etc/udev/rules/49-teensy.rules</em></p>
<blockquote><p>SUBSYSTEMS==&#8221;usb&#8221;, ATTRS{idVendor}==&#8221;16c0&#8243;, ATTRS{idProduct}==&#8221;04[789]?&#8221;, MODE:=&#8221;0666&#8243; KERNEL==&#8221;ttyACM*&#8221;, ATTRS{idVendor}==&#8221;16c0&#8243;, ATTRS{idProduct}==&#8221;04[789]?&#8221;, SYMLINK+=&#8221;ttyUSB00%n&#8221;, MODE:=&#8221;0666&#8243;, ENV{ID_MM_DEVICE_IGNORE}=&#8221;1&#8243;</p></blockquote>
<p>The host that connects to the ZZ-Teensy-Alarm needs to be able to query to the teensy on the USB Serial device to determine the status of any of the configured alarm switch inputs.  This is accomplished using a C program that will open the USB serial device presented by the teensy and write/read to the running firmware queries on port status.</p>
<p>The alarm-monitor application is a very simple C application. After initializing some variables it performs a quick check on the number of command line arguments, providing help and exiting if it is not correct. Next the application confirms that the query provided on the command line is a valid interface to query. Alarm-monitor then initializes the specified serial device to 38400 8n1 and writes out the query to the teensy serial device. Once the query is written the application will wait for a response for 10 seconds after which the appropriate response is sent back to the user.<br />
<strong>Linux Command line zz-teensy-alarm query:</strong><br />
<em>alarm-monitor.c</em></p><pre class="crayon-plain-tag"><code>#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;termios.h&gt;
#include &lt;time.h&gt;
 
int main(int argc,char** argv)
{
        struct termios tio;
        struct termios stdio;
        time_t start,now;
        int diff;
        int tty_fd;
        fd_set rdset;
        struct flock fl;
 
        unsigned char c=' ';
 
        if (argc&lt;3) {
          printf(&quot;%s /dev/ttyUSB000 [1|2|3|4]\n\n&quot;,argv[0]);
          exit(1);
        }
 
        switch (argv[2][0]) {
          case '1':
            break;
          case '2':
            break;
          case '3':
            break;
          case '4':
            break;
          default:
            printf(&quot;Can only query alarms 1, 2, 3 or 4\n\n&quot;);
            exit(1);
            break;
        }

        fl.l_type   = F_WRLCK;  /* F_RDLCK, F_WRLCK, F_UNLCK    */
        fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */
        fl.l_start  = 0;        /* Offset from l_whence         */
        fl.l_len    = 0;        /* length, 0 = to EOF           */
        fl.l_pid    = getpid(); /* our PID                      */

        tty_fd=open(argv[1], O_RDWR | O_NONBLOCK);
        fcntl(tty_fd, F_SETLKW, &amp;fl);

        memset(&amp;tio,0,sizeof(tio));
        tio.c_iflag=0;
        tio.c_oflag=0;
        // 8n1, see termios.h for more information
        tio.c_cflag=CS8|CREAD|CLOCAL;           
        tio.c_lflag=0;
        tio.c_cc[VMIN]=1;
        tio.c_cc[VTIME]=5;
 
        cfsetospeed(&amp;tio,B38400);            
        cfsetispeed(&amp;tio,B38400);           
 
        tcsetattr(tty_fd,TCSANOW,&amp;tio);
  
        write(tty_fd,argv[2],1);

        start = time(NULL);
        now = time(NULL);
        diff = (int)difftime(now,start);
        while ((c != '\n') &amp;&amp; (diff &lt; 10)) {
          if (read(tty_fd,&amp;c,1)&gt;0) {
            write(STDOUT_FILENO,&amp;c,1);
          }
          now = time(NULL);
          diff = (int)difftime(now,start);
        }

        fl.l_type   = F_UNLCK;
        fcntl(tty_fd, F_SETLK, &amp;fl);
        close(tty_fd);

        if (diff &gt;= 10) {
          printf(&quot;X:X\n&quot;);
          exit(1);
        }
        exit(0);
}</code></pre><p><p>
The alarm_monitor application can be compiled with gcc:</p>
<p style="padding-left: 30px;">gcc -o alarm_monitor alarm_monitor.c</p>
<p>alarm_monitor has 2 inputs, the first is the USB device of the ZZ-Teensy-Alarm, the 2nd is the port to be queried (1-4 is hard coded, any additional ports need to be expanded on for alarm_monitor.c and zz_alarm0.ino).</p>
<p>EX:</p>
<p style="padding-left: 30px;">alarm_monitor /dev/ttyUSB000 1<br />
1:0</p>
<p>Would query alarm switch 1 and as this example shows returns the alarm #:status where 0 is OK and 1 is switch open (alarm).</p>
<p>There is a 10 second timeout if ZZ-Teensy-Alarm device isn&#8217;t connected or if there are connectivity issues.  An error code of X:X is returned for any timeout and any query to ports other than 1,2,3,4 return invalid query.</p>
<p><strong>Concept Assembly</strong></p>
<p>The initial design was built using a breadboard and is pictured below:</p>
<div id="attachment_225" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/Zz-teensy-alarm.jpg"><img class="size-medium wp-image-225" title="ZZ Servers Teensy Cabinet Alarm Prototype" src="http://www.zendzign.com/wp-content/uploads/2012/01/Zz-teensy-alarm-300x199.jpg" alt="ZZ Servers Home Brew Server Alarm Concept" width="300" height="199" /></a><p class="wp-caption-text">ZZ Servers Teensy Cabinet Alarm Prototype</p></div>
<p>Once the design was tested a standard radio shack project box was acquired along with a few screw down termination jacks.  These were assembled into the following picture</p>
<div id="attachment_254" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0644.jpg"><img class="size-medium wp-image-254" title="ZZ Cabinet Alarm Prototype - Assembly" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0644-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembly" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembly</p></div>
<div id="attachment_255" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0645.jpg"><img class="size-medium wp-image-255" title="ZZ Cabinet Alarm Prototype - Assembly" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0645-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembly" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembly</p></div>
<p>The final configuration has the usb cable coming out one side, an led on one side and the screw on terminators ready to be connected to magnetic door switches.</p>
<div id="attachment_256" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0650.jpg"><img class="size-medium wp-image-256" title="ZZ Cabinet Alarm Prototype - Assembled" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0650-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembled" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembled</p></div>
<div id="attachment_257" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0651.jpg"><img class="size-medium wp-image-257" title="ZZ Cabinet Alarm Prototype - LED on" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0651-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - LED on" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - LED on</p></div>
<p><strong>Zabbix Integration</strong></p>
<p>Once the alarm is in place it needs to be monitored. Here at ZZ Servers we leverage Zabbix but any system such as Nagios could work as long as they can execute a script for input.</p>
<p>Zabbix monitoring can monitor the status of each door alarm through the configuration of UserParameters.  A full configuration will follow in a future post with templates for items / alerts but for now below is a sample UserParameter for each of the 4 configured alarm monitors:</p>
<p><em>/etc/zabbix/zabbix_agentd.conf</em></p>
<blockquote><p>UserParameter=CB001.0001F,/usr/local/bin/alarm-monitor /dev/ttyUSB000 1|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0001B,/usr/local/bin/alarm-monitor /dev/ttyUSB000 2|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0002F,/usr/local/bin/alarm-monitor /dev/ttyUSB000 3|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0002B,/usr/local/bin/alarm-monitor /dev/ttyUSB000 4|cut -d&#8221;:&#8221; -f 2</p></blockquote>
<p>Details on how to configure the zabbix template including the appropriate items, triggers and alerts will be posted in my next blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL Vulnerability</title>
		<link>http://www.zendzign.com/2008/05/openssh-vulnerability/</link>
		<comments>http://www.zendzign.com/2008/05/openssh-vulnerability/#comments</comments>
		<pubDate>Fri, 23 May 2008 19:18:37 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[openssl]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/2008/05/openssh-vulnerability/</guid>
		<description><![CDATA[A weakness has been discovered in the random number generator used by OpenSSL on Debian and Ubuntu systems. As a result of this weakness, certain encryption keys are much more common than they should be, such that an attacker could guess the key through a brute-force attack given minimal knowledge of the system. This particularly [...]]]></description>
			<content:encoded><![CDATA[<p>A weakness has been discovered in the random number generator used by OpenSSL on Debian and Ubuntu systems. As a result of this weakness, certain encryption keys are much more common than they should be, such that an attacker could guess the key through a brute-force attack given minimal knowledge of the system. This particularly affects the use of encryption keys in OpenSSH. </p>
<p><span id="more-14"></span></p>
<p>This vulnerability only affects operating systems which (like Ubuntu) are based on Debian. However, other systems can be indirectly affected if weak keys are imported into them. We consider this an extremely serious vulnerability, and urge all users to act immediately to secure their systems. </p>
<p>The following Ubuntu releases are affected: </p>
<ul>
<li>Ubuntu 7.04 </li>
<li>Ubuntu 7.10 </li>
<li>Ubuntu 8.04 LTS</li>
<li>Debian Etch 4.0</li>
<li>Debian Lenny 5.0</li>
</ul>
<p>For more details visit these links:</p>
<ul>
<li>Ubuntu: <a title="http://www.ubuntu.com/usn/usn-612-2" href="http://www.ubuntu.com/usn/usn-612-2">http://www.ubuntu.com/usn/usn-612-2</a></li>
<li>Debian: <a title="http://www.debian.org/security/2008/dsa-1571" href="http://www.debian.org/security/2008/dsa-1571">http://www.debian.org/security/2008/dsa-1571</a></li>
</ul>
<p>We consider this an extremely serious vulnerability, and urge all users to act immediately to secure their systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/openssh-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Set Up A Ubuntu/Debian LAMP Server</title>
		<link>http://www.zendzign.com/2008/05/how-to-set-up-a-ubuntudebian-lamp-server/</link>
		<comments>http://www.zendzign.com/2008/05/how-to-set-up-a-ubuntudebian-lamp-server/#comments</comments>
		<pubDate>Sat, 10 May 2008 14:03:53 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/2008/05/how-to-set-up-a-ubuntudebian-lamp-server/</guid>
		<description><![CDATA[Build Your Own Debian/Ubuntu LAMP Server &#8211; Quick &#38; Easy Do it Yourself Installation Apache 2 &#8211; Linux Web server MySQL 5 &#8211; MySQL Database Server PHP4/5 &#8211; PHP Scripting Language phpMyAdmin &#8211; Web-based database admin software. Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server. First, let us prepare [...]]]></description>
			<content:encoded><![CDATA[<h3>Build Your Own Debian/Ubuntu LAMP Server &#8211; Quick &amp; Easy Do it Yourself Installation</h3>
<ul>
<li>Apache 2 &#8211; Linux Web server</li>
<li>MySQL 5 &#8211; MySQL Database Server</li>
<li>PHP4/5 &#8211; PHP Scripting Language</li>
<li>phpMyAdmin &#8211; Web-based database admin software.</li>
</ul>
<p>Note: <strong>L</strong>inux + <strong>A</strong>pache + <strong>M</strong>ySQL + <strong>P</strong>HP/Perl together commonly known as <strong>LAMP Server</strong>.</p>
<p><span id="more-8"></span></p>
<p>First, let us prepare a system that has a minimum requirement of Debian/Ubuntu version of Linux with at least<strong> <a href="http://www.zzservers.com/hosting/virtual-private-servers/256/" target="_blank">256MB of RAM available</a></strong>.<strong> </strong>Anything less than this minimum ram will cause lot of problems since we are running a server along especially MySQL and Webmin requires lots of RAM to run properly. MySQL will give you this nasty error &#8220;cannot connect to mysql.sock&#8221; if you don&#8217;t have enough memory in your server.</p>
<p>I love Debian/Ubuntu based Linux because of my enormous affinity towards this command apt-get. As a starter knowing this one command, It is so easy to install packages and you don&#8217;t need to worry about package dependency and configuration. You need to buy a dedicated server or a VPS package if you want to setup your own server. If you want to experiment with the server and installation it is recommended to buy a VPS package. Believe it or not it is so easy to install and configure your server yourself even though you are new are to Linux and dedicated/VPS hosting.</p>
<p>First download <a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe" target="_blank">PuTTy</a> if you are accessing your server through SSH. Just enter the IP of your server with root login to access your host. As you probably know, <a href="http://www.webmin.com/" target="_blank">Webmin</a> is a freely available server control panel and we will setup this once we have completed the LAMP server and Mail Server. Webmin makes more easier for us to fine tune our Linux box.</p>
<p>Before proceeding to install, update the necessary packages with Debian with this command.</p>
<p class="command">apt-get install update</p>
<h3>1. Installing Apache + PHP</h3>
<p>Apache is one of the most famous web server which runs on most Linux based servers. With just few commands you can configure apache to run with PHP 4 or PHP 5.</p>
<p>If you want to install PHP 4, just apt-get</p>
<p class="command">apt-get install apache2 php4 libapache2-mod-php4</p>
<p>To install PHP5, just run the following on Linux shell. Note that if you don&#8217;t specify packages with &#8217;4&#8242;, PHP5 will be automatically installed.</p>
<p class="command">apt-get install apache2 php5 libapache2-mod-php5</p>
<p>Apache configuration file is located at: <span class="system">/etc/apache2/apache2.conf</span> and your web folder is <span class="system">/var/www</span>.</p>
<p>To check whether php is installed and running properly, just create a <span class="system">test.php</span> in your <span class="system">/var/www</span> folder with <span class="system">phpinfo()</span> function exactly as shown below.</p>
<p class="command">vi /var/www/test.php</p>
<pre class="crayon-plain-tag"><code># test.php
&amp;lt;?php phpinfo(); ?&amp;gt;</code></pre><p>Point your browser to <span class="system">http://ip.address/test.php</span> or <span class="system">http://domain/test.php</span> and this should show all your php configuration and default settings.</p>
<p>You can edit necessary values or setup virtual domains using apache configuration file.</p>
<h3>2. Installing MySQL Database Server</h3>
<p>Installing mysql database server is always necessary if you are running a database driven e-commerce site. Remember running MySQL server to a fair extend requires at least 256mb of RAM in your server. So unless you are running database driven sites you don&#8217;t absolutely need MySQL. The following commands will install MySQL 5 server and MySQL 5 client.</p>
<p class="command">apt-get install mysql-server mysql-client php5-mysql</p>
<p>Note: If you have already installed php4, you should make a slight change like this.</p>
<p class="command">apt-get install mysql-server mysql-client php4-mysql</p>
<p>The configuration file of MySQL is located at: <span class="system">/etc/mysql/my.cnf</span></p>
<h4>Creating users to use MySQL and Changing Root Password</h4>
<p>By default mysql creates user as root and runs with no passport. You might need to change the root password.</p>
<p>To change Root Password</p>
<p class="command">mysql -u root</p>
<p>mysql&gt; USE mysql;</p>
<p>mysql&gt; UPDATE user SET Password=PASSWORD(&#8216;new-password&#8217;) WHERE user=&#8217;root&#8217;;</p>
<p>mysql&gt; FLUSH PRIVILEGES;</p>
<p>You must <strong>never use root password</strong>, so you might need to create a user to connect to MySQL database for a PHP script. Alternatively you can add users to MySQL database by using a control panel like <strong>Webmin</strong> or <strong>phpMyAdmin</strong> to easily create or assign database permission to users. We will install Webmin and phpMyAdmin during later once we complete basic installation.</p>
<h3>3. PhpMyAdmin Installation</h3>
<p>PhpMyAdmin is a nice web based database management and administration software and easy to install and configure under apache. Managing databases with tables couldn&#8217;t be much simpler by using phpMyAdmin.</p>
<p>All you need to do is:</p>
<p class="command">apt-get install phpmyadmin</p>
<p>The phpMyAdmin configuration file is located at: <span class="system">/etc/phpmyadmin</span> folder.</p>
<p>To set up under Apache all you need to do is include the following line in <span class="system">/etc/apache2/apache2.conf</span>:</p><pre class="crayon-plain-tag"><code>Include /etc/phpmyadmin/apache.conf</code></pre><p>Now restart Apache:</p>
<p class="command">/etc/init.d/apache2 restart</p>
<p>Point your browser to: <span class="system">http://domain/phpmyadmin</span></p>
<p>That&#8217;s it! MySQL and phpMyAdmin are ready. Log in with your mysql root password and create users to connect to database from your php script.</p>
<p><em>This tutorial was written by Scott who currently runs <a href="http://www.mysql-apache-php.com/" target="_blank">MySQL-Apache-PHP.com</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/how-to-set-up-a-ubuntudebian-lamp-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Version of Debian Am I Running?</title>
		<link>http://www.zendzign.com/2008/05/what-version-of-debian-am-i-running/</link>
		<comments>http://www.zendzign.com/2008/05/what-version-of-debian-am-i-running/#comments</comments>
		<pubDate>Fri, 09 May 2008 18:15:25 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://zendzign.com/?p=7</guid>
		<description><![CDATA[On a Debian system, the file `/etc/debian_version&#8217; contains the release name of the Debian installed. Use cat to output the contents of this file (see Concatenating Text). * To output the release name of the Debian system you are on, type: $ cat /etc/debian_version NOTE: Debian releases have historically been named after characters from the [...]]]></description>
			<content:encoded><![CDATA[<p>On a Debian system, the file `/etc/debian_version&#8217; contains the release name of the Debian installed.</p>
<p>Use cat to output the contents of this file (see Concatenating Text).</p>
<p>* To output the release name of the Debian system you are on, type:</p>
<p>$ cat /etc/debian_version</p>
<p>NOTE: Debian releases have historically been named after characters from the motion picture Toy Story.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/what-version-of-debian-am-i-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

