<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Agent OSS</title>
	<atom:link href="http://agentoss.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://agentoss.wordpress.com</link>
	<description>Open Source Software tutorials and reviews</description>
	<lastBuildDate>Mon, 13 May 2013 19:17:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='agentoss.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Agent OSS</title>
		<link>http://agentoss.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://agentoss.wordpress.com/osd.xml" title="Agent OSS" />
	<atom:link rel='hub' href='http://agentoss.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Wifi repeater/range extender script</title>
		<link>http://agentoss.wordpress.com/2013/03/23/wifi-repeaterrange-extender-script/</link>
		<comments>http://agentoss.wordpress.com/2013/03/23/wifi-repeaterrange-extender-script/#comments</comments>
		<pubDate>Sat, 23 Mar 2013 15:18:27 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Bash scripts]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[range extender]]></category>
		<category><![CDATA[repeater]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wpa supplicant]]></category>
		<category><![CDATA[wpa wpa2]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=211</guid>
		<description><![CDATA[#!/bin/bash # # Wifi Repeater/Range extender script # # last modified 11/11/2012 # # http://agentoss.wordpress.com / fredo696@gmail.com # # thanks to : http://www.aerospacesoftware.com/howtos/Laptop-NAT-Howto.html # # hardware requirements : 2 wireless NICs # software requirements : iptables, wpa_supplicant, hostapd, dnsmasq, dhcpcd (or equivalent) # # This is a standalone script, it will not use your existing [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=211&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><code><br />
#!/bin/bash<br />
#<br />
# Wifi Repeater/Range extender script<br />
#<br />
# last modified 11/11/2012<br />
#<br />
# <a href="http://agentoss.wordpress.com" rel="nofollow">http://agentoss.wordpress.com</a> / <a href="mailto:fredo696@gmail.com">fredo696@gmail.com</a><br />
#<br />
# thanks to : <a href="http://www.aerospacesoftware.com/howtos/Laptop-NAT-Howto.html" rel="nofollow">http://www.aerospacesoftware.com/howtos/Laptop-NAT-Howto.html</a><br />
#<br />
# hardware requirements : 2 wireless NICs<br />
# software requirements : iptables, wpa_supplicant, hostapd, dnsmasq, dhcpcd (or equivalent)<br />
#<br />
# This is a standalone script, it will not use your existing configuration files<br />
# (for wpa_supplicant or hostapd)<br />
#<br />
# Both wireless interfaces will use WPA/WPA2 encryption.<br />
#<br />
# BEFORE STARTING THIS SCRIPT :<br />
# - you must have root rights<br />
# - stop your wireless connection manager (networkmanager, wicd, etc...)<br />
# - disable your firewall<br />
# - disable power management (prevent the computer to go into suspend mode when unused)<br />
#<br />
# This script has been tested on OpenSUSE 12.2, but should work on other Linux systems with minor adaptations.</p>
<p># this is the wireless interface we use to connect to our main AP<br />
WLAN_STA="wlan0"<br />
# enter here your SSID and WPA passphrase<br />
WLAN_STA_SSID="YOUR_EXISTING_SSID"<br />
WLAN_STA_PASSPHRASE="your$wpa$passphrase"</p>
<p># this is the wireless interface we use to create our new AP (the "repeater" AP)<br />
WLAN_AP="wlan1"<br />
# your new AP's SSID<br />
WLAN_AP_SSID="REPEAT_$WLAN_STA_SSID"<br />
# Be sure to use different channels for the 2 AP's for best performance<br />
WLAN_AP_CHANNEL=6<br />
WLAN_AP_IP="192.168.7.1"<br />
WLAN_AP_DHCP_RANGE="192.168.7.10,192.168.7.20"<br />
# we can use the same passphrase (or not)<br />
WLAN_AP_PASSPHRASE=$WLAN_STA_PASSPHRASE</p>
<p># temp files (will contain clear passphrases!)<br />
HOSTAP_TEMP_CONF="/root/hostap_temp.conf"<br />
WPASUPPLICANT_TEMP_CONF="/root/wpasupplicant_temp.conf"</p>
<p># Path for used commands (adapt to your system)<br />
DHCPCD="/sbin/dhcpcd"<br />
HOSTAPD="/usr/sbin/hostapd"<br />
WPASUPPLICANT="/usr/sbin/wpa_supplicant"<br />
DNSMASQ="/usr/sbin/dnsmasq"<br />
IPTABLES="/usr/sbin/iptables"</p>
<p># Main program</p>
<p># check if we are root<br />
if [[ $EUID -ne 0 ]]; then<br />
   echo `basename $0` ": must be run as root!" 1&gt;&amp;2<br />
   exit 1<br />
fi<br />
# check for software we need<br />
if [[ ! -x $DHCPCD ]]; then<br />
 echo "FATAL: $DHCPCD not found!"; exit 1<br />
fi<br />
if [[ ! -x $HOSTAPD ]]; then<br />
 echo "FATAL: $HOSTAPD not found!"; exit 1<br />
fi<br />
if [[ ! -x $WPASUPPLICANT ]]; then<br />
 echo "FATAL: $WPASUPPLICANT not found!"; exit 1<br />
fi<br />
if [[ ! -x $DNSMASQ ]]; then<br />
 echo "FATAL: $DNSMASQ not found!"; exit 1<br />
fi<br />
if [[ ! -x $IPTABLES ]]; then<br />
 echo "FATAL: $IPTABLES not found!"; exit 1<br />
fi<br />
# check for wireless interfaces<br />
ifconfig $WLAN_STA 1&gt;&amp;2&gt;/dev/null<br />
if [[ $? -ne 0 ]]; then<br />
 echo "FATAL: Wireless interface $WLAN_STA unavailable!"; exit 1<br />
fi<br />
ifconfig $WLAN_AP 1&gt;&amp;2&gt;/dev/null<br />
if [[ $? -ne 0 ]]; then<br />
 echo "FATAL: Wireless interface $WLAN_AP unavailable!"; exit 1<br />
fi</p>
<p># some cleanup<br />
# kill existing wireless connections<br />
$DHCPCD -x $WLAN_STA 2&gt;/dev/null<br />
$DHCPCD -x $WLAN_AP 2&gt;/dev/null<br />
killall wpa_supplicant 2&gt;/dev/null</p>
<p># kill running hostapd daemon if it exists<br />
killall hostapd 2&gt;/dev/null</p>
<p># kill dnsmasq dhcp<br />
killall dnsmasq 2&gt;/dev/null</p>
<p># empty existing temp.conf files, for security<br />
&gt;$HOSTAP_TEMP_CONF<br />
&gt;$WPASUPPLICANT_TEMP_CONF</p>
<p># stop the repeater? then just exit, we have already cleaned up!<br />
if [ "$1" == "stop" ]; then<br />
 echo "Repeater has been stopped."<br />
 exit 0;<br />
fi</p>
<p># else, continue and create our repeater AP<br />
echo "Please wait, starting up... "</p>
<p># create temp wpa_supplicant.conf file for our STA interface<br />
cat &gt;$WPASUPPLICANT_TEMP_CONF &lt;$HOSTAP_TEMP_CONF &lt;&lt;EOF<br />
interface=$WLAN_AP<br />
country_code=FR<br />
ieee80211d=1<br />
ssid=$WLAN_AP_SSID<br />
hw_mode=g<br />
channel=$WLAN_AP_CHANNEL<br />
wme_enabled=0<br />
macaddr_acl=0<br />
auth_algs=1<br />
wpa=2<br />
wpa_passphrase=$WLAN_AP_PASSPHRASE<br />
wpa_key_mgmt=WPA-PSK<br />
wpa_pairwise=TKIP<br />
rsn_pairwise=CCMP<br />
EOF</p>
<p># start the STA interface (my router has a DHCP server)<br />
$DHCPCD $WLAN_STA<br />
if [[ $? -ne 0 ]]; then<br />
 echo &quot;FATAL: unable to start $WLAN_STA interface! (dhcpcd)&quot;; exit 1<br />
fi</p>
<p># start hostapd daemon to create the &quot;repeater&quot; AP<br />
$HOSTAPD -B $HOSTAP_TEMP_CONF<br />
if [[ $? -ne 0 ]]; then<br />
 echo &quot;FATAL: unable to start $WLAN_AP interface (hostapd)!&quot;; exit 1<br />
fi</p>
<p># assign an IP address to the AP, and start a new DHCP server<br />
ifconfig $WLAN_AP $WLAN_AP_IP netmask 255.255.255.0<br />
$DNSMASQ --dhcp-range=$WLAN_AP_DHCP_RANGE --interface=$WLAN_AP<br />
if [[ $? -ne 0 ]]; then<br />
 echo &quot;FATAL: unable to start dhcp server! (dnsmasq)&quot;; exit 1<br />
fi</p>
<p># enable packet forwarding and add firewall rules to allow forwarding packets<br />
# between our 2 network interfaces.<br />
IF_IN=$WLAN_STA<br />
IF_OUT=$WLAN_AP</p>
<p>sysctl -w net.ipv4.ip_forward=1<br />
$IPTABLES -F<br />
$IPTABLES -P INPUT ACCEPT<br />
$IPTABLES -P OUTPUT ACCEPT<br />
$IPTABLES -P FORWARD ACCEPT<br />
$IPTABLES -t nat -A POSTROUTING -o $IF_IN -j MASQUERADE<br />
$IPTABLES -A FORWARD -i $IF_IN -o $IF_OUT -m state --state RELATED,ESTABLISHED -j ACCEPT<br />
$IPTABLES -A FORWARD -i $IF_OUT -o $IF_IN -j ACCEPT</p>
<p>echo &quot;-------------------------------------------------------------------------&quot;<br />
echo &quot;Wireless repeater access point \&quot;$WLAN_AP_SSID\&quot; is up!&quot;<br />
echo &quot;To kill it : `basename $0` stop&quot;</p>
<p>exit 0</p>
<p></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=211&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2013/03/23/wifi-repeaterrange-extender-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>
	</item>
		<item>
		<title>Debian 6.0 (Squeeze) on the Xplore iX104C3 rugged Tablet PC</title>
		<link>http://agentoss.wordpress.com/2013/02/27/debian-6-0-squeeze-on-the-xplore-ix104c3-rugged-tablet-pc/</link>
		<comments>http://agentoss.wordpress.com/2013/02/27/debian-6-0-squeeze-on-the-xplore-ix104c3-rugged-tablet-pc/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 20:13:35 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[xplore]]></category>
		<category><![CDATA[iX104c3]]></category>
		<category><![CDATA[tablet pc]]></category>
		<category><![CDATA[stylus]]></category>
		<category><![CDATA[wacom serial]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=203</guid>
		<description><![CDATA[System specs A nice review here : http://www.ruggedpcreview.com/3_slates_xplore_ix104c3.html Users handbook : ftp://Support:Xplore@ftp.xploretech.com/Reports%20and%20Handbooks/iX104C3%20USERS%20HANDBOOK.pdf Note: my model only has a digitizer (tablet PC model), no touchscreen (dual mode version) Debian stable to the rescue First I wanted to install Arch Linux on this system, but soon I encountered a severe setback : the Wacom stylus would not [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=203&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1><a href="http://agentoss.files.wordpress.com/2013/02/productid-1444-sku-ix104c3.jpg"><img class="aligncenter size-medium wp-image-204" alt="productid-1444-sku-IX104C3" src="http://agentoss.files.wordpress.com/2013/02/productid-1444-sku-ix104c3.jpg?w=300&#038;h=225" width="300" height="225" /></a></h1>
<h1>System specs</h1>
<p>A nice review here : <a href="http://www.ruggedpcreview.com/3_slates_xplore_ix104c3.html">http://www.ruggedpcreview.com/3_slates_xplore_ix104c3.html</a></p>
<p>Users handbook : <a href="ftp://Support:Xplore@ftp.xploretech.com/Reports%20and%20Handbooks/iX104C3%20USERS%20HANDBOOK.pdf">ftp://Support:Xplore@ftp.xploretech.com/Reports%20and%20Handbooks/iX104C3%20USERS%20HANDBOOK.pdf</a></p>
<p>Note: my model only has a digitizer (tablet PC model), no touchscreen (dual mode version)</p>
<h1>Debian stable to the rescue</h1>
<p>First I wanted to install Arch Linux on this system, but soon I encountered a severe setback : the Wacom stylus would not work. Then I tried Ubuntu 12.04 (Precise), everything worked out of the box, except the stylus!<br />
Explanation : it seems the support for this older, serial Wacom tablet has been removed from the X.Org Wacom input drivers, since the 0.10.6 version and up.<br />
(more info can be found here : <a href="http://ubuntuforums.org/showthread.php?t=1780154">http://ubuntuforums.org/showthread.php?t=1780154</a> )</p>
<p><strong>Fortunately Debian Squeeze still uses a working 0.10.5 driver version!</strong></p>
<p><span id="more-203"></span></p>
<h1>Dual booting</h1>
<p>I chose to keep the original Windows XP (Tablet PC edition) so I used PartedMagic / Gparted to shrink the windows partition (40G should be large enough).</p>
<p>If ever needed to restore the original windows sytem, recovery disks and drivers can be found here : <a href="http://www.xploretech.com/support/download_center">http://www.xploretech.com/support/download_center</a></p>
<h1></h1>
<h1>Debian Installation</h1>
<p>This will be an i386 Debian since the Pentium M processor is 32bit only.</p>
<p>Plug an usb keyboard (optional : a mouse if using the graphical installer).</p>
<p>I installed my system from the network (netinstall with PXE booting). The wired network interface (realtek RTL8169sb/8110sb) works out of the box, the Intel wireless adapter (ipw2200) needs a firmware (will be installed later after we enable the non-free repository).</p>
<p>A standard (Gnome 2) desktop environment was selected.</p>
<p>Installation done, reboot into your newly installed system.</p>
<p>Note : when not using an usb keyboard, you will want to :</p>
<ul>
<li>enable automatic login in gdm3</li>
<li>disable screen locking</li>
</ul>
<p>(we will work on these two things a bit later)</p>
<h1>System configuration</h1>
<p>Still, the Wacom stylus does not work out of the box.</p>
<h2>Configuring the Wacom stylus</h2>
<p>We need to add some udev rules<br />
# nano /etc/udev/rules.d/70-wacom-serial.rules</p>
<pre>ACTION!="add|change", GOTO="wacom_end"

# Match all serial wacom tablets with a serial ID starting with WACf
# Notes: We assign NAME though we shouldn't, but currently the server requires it.
#        We assign the lot to subsystem pnp too because server reads NAME from
#        the parent device. Once all that's fixed, a simple SUBSYSTEM="tty"
#        will do and the ENV{NAME} can be removed.
SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="WACf*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tab
let $attr{id}"
SUBSYSTEM=="tty|pnp", SUBSYSTEMS=="pnp", ATTRS{id}=="FUJ*", ENV{ID_MODEL}="Serial Wacom Tablet $attr{id}", ENV{ID_INPUT}="1", ENV{ID_INPUT_TABLET}="1", ENV{NAME}="Serial Wacom Tabl
et $attr{id}"

LABEL="wacom_end"</pre>
<p>Then we also need to tell X.Org about our tablet<br />
# mkdir -p /etc/X11/xorg.conf.d/<br />
# cat &gt;/etc/X11/xorg.conf.d/50-wacom.conf &lt;&lt;EOF</p>
<pre>Section "InputClass"
Identifier "Wacom class"
MatchProduct "Wacom|WACOM|Hanwang|PTK-540WL"
MatchDevicePath "/dev/input/event*"
Driver "wacom"
EndSection

Section "InputClass"
Identifier "Wacom serial class"
MatchProduct "Serial Wacom Tablet"
Driver "wacom"
EndSection

Section "InputClass"
Identifier "Wacom serial class identifiers"
MatchProduct "WACf|FUJ02e5|FUJ02e7|FUJ02e9"
Driver "wacom"
Option "Button1" "1"        # left mouse button
Option "Button2" "3"        # right mouse button
EndSection
EOF</pre>
<p>Reboot your system, the stylus should now be working!</p>
<h2>Stylus calibration</h2>
<p>If needed to perform stylus calibration, we will install xinput_calibrator from the sources (package is not available for Squeeze)<br />
<a href="http://www.freedesktop.org/wiki/Software/xinput_calibrator">http://www.freedesktop.org/wiki/Software/xinput_calibrator</a></p>
<p>As a regular user<br />
$ sudo apt-get install build-essential dh-autoreconf libx11-dev libxext-dev libxi-dev<br />
$ cd &amp;&amp; wget <a href="http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz" rel="nofollow">http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz</a><br />
$ tar xvzf xinput_calibrator* &amp;&amp; cd xinput_calibrator*<br />
$ ./autogen.sh &amp;&amp; make &amp;&amp; sudo make install</p>
<p>Now run<br />
$ xinput_calibrator &#8211;output-type xorg.conf.d</p>
<p>Finally, as root, copy and paste the program&#8217;s output (the &#8220;option&#8221; lines) into your /etc/X11/xorg.conf.d/50-wacom.conf<br />
(restart X for changes to take effect)</p>
<h2>Updating the kernel (optional)</h2>
<p>Enable the Debian backports<br />
# echo &gt;&gt;/etc/apt/sources.list &#8216;deb <a href="http://backports.debian.org/debian-backports" rel="nofollow">http://backports.debian.org/debian-backports</a> squeeze-backports main&#8217; &amp;&amp; apt-get update<br />
# apt-get -t squeeze-backports install linux-image-686-pae</p>
<p>Enabling the non-free repo<br />
# nano /etc/apt/sources.list</p>
<p>(your debian mirror will vary)</p>
<p>deb <a href="http://ftp.fr.debian.org/debian/" rel="nofollow">http://ftp.fr.debian.org/debian/</a> squeeze main contrib non-free</p>
<p>And installing the non-free firmwares<br />
# apt-get update &amp;&amp; apt-get install firmware-linux-nonfree firmware-ipw2x00 firmware-realtek</p>
<p>(reboot system)</p>
<p>Installing a newer Iceweasel (<a href="http://mozilla.debian.net/">http://mozilla.debian.net/</a>)<br />
# echo &gt;&gt;/etc/apt/sources.list &#8216;deb <a href="http://mozilla.debian.net/" rel="nofollow">http://mozilla.debian.net/</a> squeeze-backports iceweasel-release&#8217;<br />
# apt-get update &amp;&amp; apt-get install -t squeeze-backports iceweasel</p>
<p>Interesting add-ons for Iceweasel/Firefox :</p>
<p>FireGestures<br />
<a href="https://addons.mozilla.org/en-US/firefox/addon/firegestures/">https://addons.mozilla.org/en-US/firefox/addon/firegestures/</a></p>
<h2>Accessibility tools</h2>
<p>The Gnome On-screen Keyboard (GOK) was installed by default. I found it to be quite annoying to use (and sometimes buggy).<br />
# apt-get remove gok</p>
<p>(There&#8217;s also Dasher. Haven&#8217;t tried it yet)</p>
<p>brltty (the Braille daemon) was also installed. As I don&#8217;t need it (and it takes some CPU time) :<br />
# apt-get remove brltty</p>
<p>Same with Orca, the screen reader<br />
# apt-get remove gnome-orca</p>
<p>So let&#8217;s install a nicer virtual keyboard :</p>
<p>Florence ( <a href="http://florence.sourceforge.net/english.html">http://florence.sourceforge.net/english.html</a> )<br />
# apt-get install florence</p>
<p>Matchbox keyboard (light but less integrated into Gnome)<br />
# apt-get install matchbox-keyboard</p>
<p>Enabling Florence at the GDM login screen<br />
# cp /usr/share/applications/florence.desktop /usr/share/gdm/autostart/LoginWindow/</p>
<p>(you may now remove autologin in GDM)</p>
<p>Enable virtual keyboard when screen is locked ( <a href="https://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions">https://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions</a> )</p>
<p>For some reason I wasn&#8217;t able to use Florence instead of matchbox-keyboard.<br />
In GConf editor :</p>
<p>set /apps/gnome-screensaver/embedded_keyboard_enable to &#8220;true&#8221;<br />
set /apps/gnome-screensaver/embedded_keyboard_command to &#8220;matchbox-keyboard &#8211;xid&#8221;</p>
<p>Allow virtual keyboard with gksu</p>
<p>Open GConf editor :</p>
<p>Set /apps/gksu/disable-grab to &#8220;true&#8221;</p>
<p>Some more applications for hand writing/drawing with the stylus</p>
<p>Xournal note taking<br />
# apt-get install xournal</p>
<p>Mypaint drawing<br />
# apt-get install mypaint</p>
<h2>Special keys</h2>
<p>By default on this hardware :</p>
<p>- the P1 key is mapped to F1<br />
- P2 is mapped to F2<br />
- P3 is mapped to F8<br />
- Fn is mapped to F11<br />
- &#8220;screen rotation&#8221; key is mapped to F12<br />
- &#8220;secure&#8221; key is mapped to Ctrl-Alt-Del</p>
<p>How to see the corresponding keycodes? Just start<br />
$ xev</p>
<p>Then try each special key.</p>
<p>P1 is keycode 0&#215;67<br />
P2 is 0&#215;68<br />
P3 is 0&#215;74<br />
Fn is 0&#215;95<br />
&#8220;Rotation key&#8221; is 0&#215;96<br />
&#8220;Secure key&#8221; will send the 3 keycodes corresponding to Ctrl-Alt-Del</p>
<p>Now modify your hotkey shortcuts in the Gnome settings.</p>
<h2>Screen rotation</h2>
<p>Copy this small script to /usr/local/bin/rotate.sh<br />
# cat &gt;/usr/local/bin/rotate.sh &lt;&lt;EOF<br />
#!/bin/bash<br />
#<br />
# Rotate the screen clockwise 90 degrees.<br />
# Also, rotate the wacom pointer so the stylus will still work.<br />
#<br />
# Original script by Ben Wong,  October 1, 2010<br />
# Public domain.  No rights reserved.<br />
#<br />
# Modified by <a href="mailto:fredo696@gmail.com">fredo696@gmail.com</a> / <a href="http://agentoss.wordpress.com" rel="nofollow">http://agentoss.wordpress.com</a><br />
# for use on Debian 6.0<br />
# February 10, 2013<br />
#</p>
<p># set your wacom device name here (xsetwacom &#8211;list)<br />
stylusdevname=&#8221;Serial Wacom Tablet WACf004 PNP0501&#8243;</p>
<p>case $(xsetwacom get &#8220;$stylusdevname&#8221; Rotate) in<br />
CCW)  # Currently top is rotated left, we should set it normal (0°)<br />
xrandr -o normal<br />
xsetwacom set &#8220;$stylusdevname&#8221; Rotate NONE<br />
;;<br />
NONE)  # Screen is not rotated, we should rotate it right (90°)<br />
xrandr -o right<br />
xsetwacom set &#8220;$stylusdevname&#8221; Rotate CW<br />
;;<br />
CW)    # Top of screen is rotated right, we should invert it (180°)<br />
xrandr -o inverted<br />
xsetwacom set &#8220;$stylusdevname&#8221; Rotate HALF<br />
;;<br />
HALF)  # Screen is inverted, we should rotate it left (270°)<br />
xrandr -o left<br />
xsetwacom set &#8220;$stylusdevname&#8221; Rotate CCW<br />
;;<br />
*)<br />
echo &#8220;Unknown result from &#8216;xsetwacom get $stylusdevname Rotate&#8217;&#8221; &gt;&amp;2<br />
exit 1<br />
;;<br />
esac<br />
exit 0<br />
EOF</p>
<p>And make it executable<br />
# chmod +x /usr/local/bin/rotate.sh</p>
<p>Now setup the &#8220;screen rotation&#8221; hotkey in the Gnome2 hotkey settings, to execute this script. Should work nicely <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Gnome hotkey settings are good when you want to launch a program with a hotkey, but is not adapted when you want to remap a key.<br />
To do key remapping we will use xmodmap ( <a href="https://wiki.archlinux.org/index.php/Extra_Keyboard_Keys_in_Xorg">https://wiki.archlinux.org/index.php/Extra_Keyboard_Keys_in_Xorg</a> )</p>
<p>For instance I like the P2 and P3 buttons to act as Page_Up and Page_Down (useful when browsing)</p>
<p>As a regular user<br />
$ nano ~/.Xmodmap</p>
<p># P2 = F2 key = Page Up<br />
keycode 68 = Page_Up<br />
# P3 = F8 key = Page Down<br />
keycode 74 = Page_Down</p>
<p>To test your .Xmodmap<br />
$ xmodmap ~/.Xmodmap</p>
<p>When login in your next Gnome session, you will be asked if you want to load an .Xmodmap file, we select it and say yes of course.</p>
<p>Note : when using this method of key remapping, you will loose the actual F2 and F8 keys on the virtual keyboard.</p>
<p>TODO : Fingerprint scanner<br />
The fingerprint reader module is a SGS Thomson/UPEK model (usb id 0483:2016). See more at <a href="http://www.freedesktop.org/wiki/Software/fprint/libfprint/upekts">http://www.freedesktop.org/wiki/Software/fprint/libfprint/upekts</a><br />
# lsusb</p>
<p>Fingerprint GUI project<br />
<a href="http://www.n-view.net/Appliance/fingerprint/index.php">http://www.n-view.net/Appliance/fingerprint/index.php</a><br />
# wget <a href="http://www.n-view.net/Appliance/fingerprint/download/fingerprint-gui-1.04.tar.gz" rel="nofollow">http://www.n-view.net/Appliance/fingerprint/download/fingerprint-gui-1.04.tar.gz</a></p>
<p>or libfprint<br />
<a href="http://www.freedesktop.org/wiki/Software/fprint/Installation">http://www.freedesktop.org/wiki/Software/fprint/Installation</a></p>
<h2>Sound</h2>
<p>Sound playback works out of the box; recording from the builtin mic needed some fiddling.</p>
<p>You need to enable some controls in the gnome volume control utility. See screenshots below.</p>
<p><a href="http://agentoss.files.wordpress.com/2013/02/capture-prc3a9fc3a9rences-du-contrc3b4leur-de-volume.png"><img class="aligncenter" alt="Capture-Préférences du contrôleur de volume" src="http://agentoss.files.wordpress.com/2013/02/capture-prc3a9fc3a9rences-du-contrc3b4leur-de-volume.png?w=212&#038;h=300" width="212" height="300" /></a><a href="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer-1.png"><img class="aligncenter size-medium wp-image-208" alt="Capture-Contrôleur de volume : Intel 82801DB-ICH4 (Alsa mixer)-1" src="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer-1.png?w=300&#038;h=211" width="300" height="211" /></a> <a href="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer.png"><img class="aligncenter size-medium wp-image-207" alt="Capture-Contrôleur de volume : Intel 82801DB-ICH4 (Alsa mixer)" src="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer.png?w=300&#038;h=211" width="300" height="211" /></a></p>
<h2>Voice control and speech recognition</h2>
<p>Google Chrome + speech recognition extension</p>
<p>Web speech API is now available with Chrome version 25 or later<br />
<a href="https://www.google.com/intl/en/chrome/demos/speech.html">https://www.google.com/intl/en/chrome/demos/speech.html</a></p>
<p>Download and install the .deb package from the official site, here for the 32 bits version<br />
$ wget <a href="https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb" rel="nofollow">https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb</a><br />
$ sudo dpkg -i google-chrome*<br />
(if apt complains about missing dependencies)<br />
$ sudo apt-get -f install</p>
<p>Next, install a speech recognition extension. I suggest : &#8220;Speech Recognition for Text inputs&#8221;<br />
(website at <a href="http://www.nonelike.me/2012/03/chrome-speech-recognition-extension.html">http://www.nonelike.me/2012/03/chrome-speech-recognition-extension.html</a> )</p>
<p>Works nicely <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>(sadly, I don&#8217;t think Firefox/Iceweasel has a similar working extension yet)</p>
<h2>Power Management</h2>
<p>The battery has quite a short autonomy on this model, thus it&#8217;s important to optimize energy consumption.</p>
<p>CPU frequency scaling works out of the box.</p>
<p>Suspend to RAM (sleep) and Suspend to disk (hibernate) are working fine.</p>
<p>Still we need to install some useful tools<br />
# apt-get install laptop-mode-tools powertop</p>
<p>Configure laptop-mode-tools<br />
# nano /etc/laptop-mode/laptop-mode.conf</p>
<p>ENABLE_AUTO_MODULES=1</p>
<p>Edit LCD brightness settings<br />
# nano /etc/laptop-mode/conf.d/lcd-brightness.conf</p>
<p>TO FIX : does not work. Modifying the value in /sys/class/backlight/intel_backlight/brightness seems to do nothing</p>
<p># grep . /sys/class/backlight/intel_backlight/*</p>
<p>Enable bluetooth power off<br />
# nano /etc/laptop-mode/conf.d/bluetooth.conf</p>
<p>CONTROL_BLUETOOTH=1</p>
<p>Other modules should have good default settings.</p>
<p>Finally restart the laptop-mode daemon<br />
# /etc/init.d/laptop-mode restart</p>
<p>Also run powertop for other possible optimizations.</p>
<p>Show battery level and health in a terminal:<br />
# acpi -i</p>
<p>TODO : disable GPS for lower energy consumption (kernel module : ftdi_sio)</p>
<h2>Optimizations</h2>
<p>Filesystem optimizations (noatime, tmpfs)<br />
# nano /etc/fstab</p>
<p>proc            /proc           proc    defaults            0       0<br />
UUID=xxxxxxxxxx /               ext4    errors=remount-ro,noatime 0       1<br />
UUID=xxxxxxxxxx /home           ext4    defaults,noatime        0       2<br />
UUID=xxxxxxxxxx none            swap    sw                  0       0<br />
tmpfs           /tmp            tmpfs   defaults,nosuid,nodev   0       0</p>
<p>Minimize swappiness (for less disk usage)<br />
# sysctl -w &#8216;vm.swappiness=0&#8242;<br />
# nano /etc/sysctl.conf</p>
<p>vm.swappiness = 0</p>
<p>Prelink binaries for faster loading<br />
# apt-get install prelink<br />
# prelink -a</p>
<p>(Remember to run prelink after software updates)</p>
<p>Sensors configuration (optional) for system temperature monitoring<br />
# sensors-detect</p>
<h2>Some minor cosmetic changes</h2>
<p>Grub bootloader</p>
<p>Choose an image and convert it to PNG format using &#8220;convert&#8221; from the imagemagick package<br />
$ convert image.jpg boot.png</p>
<p>Change the default background image<br />
# nano /etc/default/grub</p>
<p>GRUB_GFXMODE=1024&#215;768<br />
GRUB_GFXPAYLOAD_LINUX=&#8221;keep&#8221;<br />
GRUB_BACKGROUND=&#8221;path/to/the/boot.png&#8221;</p>
<p>Then<br />
# update-grub</p>
<p>GDM3&#8242;s default background image can be changed as well<br />
# nano /usr/share/gdm/greeter-config/10_desktop-base</p>
<h2>GPS Applications</h2>
<p>Install the gpsd GPS daemon<br />
# apt-get install gpsd gpsd-clients</p>
<p>Configure your GPS device<br />
# dpkg-reconfigure gpsd</p>
<p>device should by /dev/ttyUSB0</p>
<p>Start gpsd<br />
# /etc/init.d/gpsd restart</p>
<p><strong>Note: You&#8217;ll may have to get outside to properly receive GPS signal!</strong></p>
<p>Navigation software</p>
<p>FoxtrotGPS (lightweight on dependencies)<br />
# apt-get install foxtrotgps</p>
<p>gpsdrive (heavier on dependencies)<br />
# apt-get install gpsdrive</p>
<p>Viking (not as easy to use)<br />
# apt-get install viking</p>
<p>(there are plenty others)</p>
<h1>Conclusion</h1>
<p>If you own a similar computer running Linux, please share your comments, tips &amp; tricks, etc!</p>
<h1>Links</h1>
<p>Debian Linux on a Tablet PC Howto<br />
<a href="http://risujin.org/debian/">http://risujin.org/debian/</a></p>
<p>Tablet PC tips from the Arch wiki<br />
<a href="https://wiki.archlinux.org/index.php/Tablet_PC">https://wiki.archlinux.org/index.php/Tablet_PC</a></p>
<h1>TODO</h1>
<p>cellwriter (handwriting recognition)<br />
voice control<br />
navit (gps)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=203&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2013/02/27/debian-6-0-squeeze-on-the-xplore-ix104c3-rugged-tablet-pc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2013/02/productid-1444-sku-ix104c3.jpg?w=300" medium="image">
			<media:title type="html">productid-1444-sku-IX104C3</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2013/02/capture-prc3a9fc3a9rences-du-contrc3b4leur-de-volume.png?w=212" medium="image">
			<media:title type="html">Capture-Préférences du contrôleur de volume</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer-1.png?w=300" medium="image">
			<media:title type="html">Capture-Contrôleur de volume : Intel 82801DB-ICH4 (Alsa mixer)-1</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2013/02/capture-contrc3b4leur-de-volumec2a0-intel-82801db-ich4-alsa-mixer.png?w=300" medium="image">
			<media:title type="html">Capture-Contrôleur de volume : Intel 82801DB-ICH4 (Alsa mixer)</media:title>
		</media:content>
	</item>
		<item>
		<title>Debian Wheezy and systemd</title>
		<link>http://agentoss.wordpress.com/2013/02/21/debian-wheezy-and-systemd/</link>
		<comments>http://agentoss.wordpress.com/2013/02/21/debian-wheezy-and-systemd/#comments</comments>
		<pubDate>Thu, 21 Feb 2013 10:35:52 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[wheezy]]></category>
		<category><![CDATA[systemd]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=201</guid>
		<description><![CDATA[Debian 7.0 (Wheezy) can be configured to use systemd. # apt-get install systemd # less /usr/share/doc/systemd/README.Debian # nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT=&#8221;quiet init=/bin/systemd&#8221; # update-grub &#38;&#38; reboot &#160; That&#8217;s it! Now experiment with # man systemd # systemctl # systemd-journalctl # systemctl reboot &#8230;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=201&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Debian 7.0 (Wheezy) can be configured to use <a href="http://freedesktop.org/wiki/Software/systemd">systemd</a>.</p>
<p># apt-get install systemd</p>
<p># less /usr/share/doc/systemd/README.Debian</p>
<p># nano /etc/default/grub</p>
<p>GRUB_CMDLINE_LINUX_DEFAULT=&#8221;quiet init=/bin/systemd&#8221;</p>
<p># update-grub &amp;&amp; reboot</p>
<p>&nbsp;</p>
<p>That&#8217;s it!</p>
<p>Now experiment with</p>
<p># man systemd</p>
<p># systemctl</p>
<p># systemd-journalctl</p>
<p># systemctl reboot</p>
<p>&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=201&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2013/02/21/debian-wheezy-and-systemd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>
	</item>
		<item>
		<title>Home mail server with Postfix + Dovecot (IMAP) + Squirrelmail/Roundcube on NetBSD 6.0.1</title>
		<link>http://agentoss.wordpress.com/2013/01/06/home-mail-server-with-postfix-dovecot-imap-squirrelmailroundcube-on-netbsd-6-0-1/</link>
		<comments>http://agentoss.wordpress.com/2013/01/06/home-mail-server-with-postfix-dovecot-imap-squirrelmailroundcube-on-netbsd-6-0-1/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 16:28:07 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[netbsd]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[roundcube]]></category>
		<category><![CDATA[squirrelmail]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[webmail]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=193</guid>
		<description><![CDATA[NetBSD 6.0.1 Goals lightweight (no mysql server, no antivirus) simple (no virtual domains/users) secure Requirements a valid internet domain name if you want to be able to send/receive email to/from the internet (buy a domain or take a free one at http://freedns.afraid.org ) valid DNS records for your domain we assume your mail server is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=193&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://agentoss.files.wordpress.com/2013/01/netbsd-smaller-tb.png"><img class="aligncenter size-full wp-image-196" alt="NetBSD-smaller-tb" src="http://agentoss.files.wordpress.com/2013/01/netbsd-smaller-tb.png?w=869"   /></a></p>
<p><span class="Apple-style-span" style="font-size:28px;font-weight:bold;">NetBSD 6.0.1</span></p>
<h2>Goals</h2>
<ul>
<li>lightweight (no mysql server, no antivirus)</li>
<li>simple (no virtual domains/users)</li>
<li>secure</li>
</ul>
<h2>Requirements</h2>
<ul>
<li>a valid internet domain name if you want to be able to send/receive email to/from the internet (buy a domain or take a free one at <a href="http://freedns.afraid.org">http://freedns.afraid.org</a> )</li>
<li>valid DNS records for your domain</li>
<li>we assume your mail server is behind a properly configured router/gateway/firewall</li>
</ul>
<h2>Hardware/Virtual machine requirements</h2>
<ul>
<li>512M RAM</li>
<li>3G of disk space minimum, 8G recommended</li>
</ul>
<h1><span id="more-193"></span></h1>
<h1>Install NetBSD</h1>
<p>Install from iso : <a href="http://www.netbsd.org/mirrors/#iso">http://www.netbsd.org/mirrors/#iso</a></p>
<p>Installation without X11</p>
<p>Note : if you later decide to install software such as Munin, you will need the X11 libraries so it&#8217;s better in this case to do a full installation.</p>
<p>Configure network</p>
<ul>
<li>Your DNS domain : domain.tld (replace by your own)</li>
<li>Your host name: mx (or &#8220;mail&#8221;, or anything you want)</li>
</ul>
<p>(so the fully qualified domain name FQDN for this system is : <b>mx.domain.tld</b>)</p>
<ul>
<li>Enable sshd : YES</li>
<li>Enable ntpd : YES</li>
<li>Run ntpdate at boot : YES</li>
</ul>
<p>Installation finished, reboot, login as root</p>
<pre> # man afterboot
 # man hier</pre>
<p>Change root password if not done at install time</p>
<pre> # passwd root</pre>
<p><em>* USE A STRONG PASSWORD! *</em></p>
<p>Create a regular UNIX user, with a home directory created (we want to store our mails in ~/Maildir) Also add the user to the wheel group (for &#8220;su&#8221; ability)</p>
<pre> # useradd -m -G wheel fred
 # passwd fred</pre>
<p><em>* USE A STRONG PASSWORD! *</em></p>
<p>Now you can login via ssh with your regular user to start your copy/paste session <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>First we switch to root</p>
<pre> # su -</pre>
<p>Set mirror for downloading binary packages</p>
<pre> # export PKG_PATH=ftp://ftp2.fr.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/6.0_2012Q3/All
 # echo &gt;&gt;~/.profile "export PKG_PATH=$PKG_PATH"</pre>
<p>(adjust to another mirror and repository if needed)</p>
<p>My survival kit in BSD-land <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre> # pkg_add -v bash nano pkgin
 # echo &gt;&gt;~/.profile 'export EDITOR=nano'</pre>
<p>Notes : &#8211; packages are installed into /usr/pkg/ &#8211; if you need to see again the included notes for a given package : pkg_info</p>
<p>Change default shell for root</p>
<pre> # whereis bash
 # export EDITOR=nano; chsh</pre>
<p>Shell : /usr/pkg/bin/bash</p>
<p>Start a new bash shell</p>
<pre> # bash</pre>
<h2>Postfix configuration</h2>
<p>Good news, Postfix is part of the netbsd base install and therefore already installed and running! But we need to adjust its configuration. (docs are in /usr/share/examples/postfix/)</p>
<p>We want to store our mail messages in Maildir format, not in mbox format</p>
<pre> # postconf -e 'home_mailbox = Maildir/'</pre>
<p>(or uncomment the line which is already present in the /etc/postfix/main.cf)</p>
<p>If you need to use a relayhost to send messages to the internet (in most cases, your ISP&#8217;s relay mail server)</p>
<pre> # postconf -e 'relayhost=[smtp.yourisp.org]'</pre>
<p>Note : if you need to authenticate yourself on the relayhost, read instructions in /usr/share/examples/postfix/SOHO_README</p>
<p>We need proper internet domain and hostname</p>
<pre> # postconf -e 'mydomain=domain.tld'
 # postconf -e 'myhostname=mx.domain.tld'</pre>
<p>Allow delivery to user@$mydomain</p>
<pre> # postconf -e 'mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost'</pre>
<p>Generate a self-signed SSL certificate and private key for our system</p>
<pre> # mkdir -p /etc/ssl/{certs,private}
 # cp /usr/share/examples/openssl/openssl.cnf /etc/openssl/
 # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/myserver.key -out /etc/ssl/certs/myserver.crt
 # chmod 600 /etc/ssl/private/myserver.key</pre>
<p>Enable TLS/SSL support for security (see /usr/share/examples/postfix/TLS_README for more)</p>
<pre> # postconf -e 'smtpd_tls_security_level=may'
 # postconf -e 'smtpd_use_tls=yes'
 # postconf -e 'smtpd_tls_auth_only=yes'
 # postconf -e 'smtpd_tls_cert_file=/etc/ssl/certs/myserver.crt'
 # postconf -e 'smtpd_tls_key_file=/etc/ssl/private/myserver.key'
 # postconf -e 'smtpd_tls_loglevel=1'</pre>
<p>The rest of the postfix configuration is set to sane defaults.</p>
<p>Enable inbound smtp reception</p>
<pre> # nano /etc/postfix/master.cf</pre>
<p>uncomment the first &#8220;smtp&#8221; line</p>
<p>Changes made, reload postfix</p>
<pre> # /etc/rc.d/postfix reload</pre>
<p>Send a test mail from root to your regular user</p>
<pre> # echo "from my netbsd mailserver" | mail -s "test mail" fred</pre>
<p>Look at the log to see if everything went fine</p>
<pre> # tail /var/log/maillog</pre>
<p>Also it&#8217;s a good idea to forward system mails (sent to root) to our regular user</p>
<pre> # nano /etc/mail/aliases</pre>
<p>add a line at the end :</p>
<p>root: fred</p>
<p>Save and don&#8217;t forget :</p>
<pre> # newaliases</pre>
<h2>Installing packages with pkgin</h2>
<p>pkgin is an enhanced package manager similar to apt/yum/zypper. You must also specify the correct PKG_PATH in its configuration file.</p>
<pre> # echo $PKG_PATH &gt;/usr/pkg/etc/pkgin/repositories.conf &amp;&amp; pkgin update</pre>
<p>For those who are on dynamic IP, you can use ddclient to update your DNS records (see your domain name registrar)</p>
<pre> # pkgin in ddclient
 # nano /usr/pkg/etc/ddclient.conf</pre>
<p>(I personally use n$m$ch$$p and it works perfectly)</p>
<p>Test your settings</p>
<pre> # ddclient -verbose -daemon 0</pre>
<p>Start daemon</p>
<pre> # cp -v /usr/pkg/share/examples/rc.d/ddclient /etc/rc.d/
 # echo &gt;&gt;/etc/rc.conf 'ddclient=YES' &amp;&amp; /etc/rc.d/ddclient start</pre>
<p>Check your DNS records</p>
<pre> # dig domain.tld -t any</pre>
<p>or</p>
<pre> # host -a domain.tld</pre>
<h2>Antispam : greylisting with postgrey</h2>
<p>(unlike some other greylisting software for postfix, postgrey doesn&#8217;t need a mysql server)</p>
<pre> # pkgin in postgrey</pre>
<p>Start daemon</p>
<pre> # cp -v /usr/pkg/share/examples/rc.d/postgrey /etc/rc.d/
 # echo &gt;&gt;/etc/rc.conf 'postgrey=YES' &amp;&amp; /etc/rc.d/postgrey start</pre>
<p>See the documentation</p>
<pre> # perldoc postgrey</pre>
<p>Adjust postfix for using postgrey daemon</p>
<pre> # postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service inet:127.0.0.1:2525'
 # /etc/rc.d/postfix reload</pre>
<p>Note : in NetBSD, the postgrey daemon is configured to listen on the 2525/tcp port, not 10023/tcp.</p>
<p>Now in order to test if postgrey actually works properly, send an email to your system from an external email address, and check the mail log</p>
<pre> # tail /var/log/maillog | grep postgrey</pre>
<h2>Antispam : spamassassin/spamass-milter</h2>
<pre> # pkgin in spamass-milter</pre>
<p>(will include spamassassin as a dependency)</p>
<p>Copy the rc.d files</p>
<pre> # cp -v /usr/pkg/share/examples/rc.d/{spamd,spamass-milter} /etc/rc.d/</pre>
<p>The /etc/rc.d/spamass-milter must be corrected (this dirty hack is needed otherwise postfix will not be able to access the socket and the milter will fail)</p>
<p><code># cat &gt;&gt;/etc/rc.d/spamass-milter &lt;&lt;EOF</code></p>
<pre> echo -n "Changing /var/run/spamass.sock ownership and permissions..."
 sleep 1
 chown postfix:postfix /var/run/spamass.sock
 chmod 0660 /var/run/spamass.sock
 echo " done"
 EOF</pre>
<p>Adjust Spamassassin&#8217;s settings</p>
<pre> # nano /usr/pkg/etc/spamassassin/local.cf</pre>
<p>Uncomment the &#8220;rewrite_header Subject&#8221; directive.</p>
<p>Start daemons</p>
<pre> # echo &gt;&gt;/etc/rc.conf 'spamd=YES' &amp;&amp; /etc/rc.d/spamd start
 # echo &gt;&gt;/etc/rc.conf 'spamass_milter=YES' &amp;&amp; /etc/rc.d/spamass-milter start</pre>
<p>Integrate spamass-milter with postfix (Note : this was taken from a working Debian/Postfix/Spamass-milter config <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<pre> # postconf -e 'smtpd_milters=unix:/var/run/spamass.sock'
 # postconf -e 'milter_default_action=accept'
 # postconf -e 'milter_connect_macros= j {daemon_name} v {if_name} _'
 # /etc/rc.d/postfix reload</pre>
<p>Update spamassassin&#8217;s rules</p>
<pre> # sa-update -v &amp;&amp; /etc/rc.d/spamd reload</pre>
<p>Create a new cron job for daily update</p>
<pre> # crontab -e

 @daily /usr/pkg/bin/sa-update &gt;/dev/null 2&gt;&amp;1 &amp;&amp; /etc/rc.d/spamd reload &gt;/dev/null 2&gt;&amp;1</pre>
<p>Testing your antispam settings Send yourself a sample spam email (from an external email account), see /usr/pkg/share/doc/spamassassin/sample-spam.txt</p>
<p>TODO : train system for spam recognition</p>
<pre> # perldoc sa-learn</pre>
<h2>Install IMAP server : Dovecot</h2>
<pre> # pkgin in dovecot-2</pre>
<p>Dovecot configuration files are located in : /usr/pkg/etc/dovecot/ Log file is : /var/log/maillog</p>
<p>Edit default config, I disable pop3 since I don&#8217;t use it.</p>
<pre> # cd /usr/pkg/etc/dovecot/
 # nano dovecot.conf 
 protocols = imap lmtp</pre>
<p>Now edit the 10-ssl.conf file and change the path for the certificate</p>
<pre> # nano conf.d/10-ssl.conf</pre>
<p><code>ssl = yes</code></p>
<p><code>ssl_cert = &lt;/etc/ssl/certs/myserver.crt</code></p>
<p><code>ssl_key = &lt;/etc/ssl/private/myserver.key</code></p>
<p>Next, we want to use MailDir format for storing our messages, in our user&#8217;s home directory.</p>
<pre> # nano conf.d/10-mail.conf</pre>
<p><code>mail_location = maildir:~/Maildir</code></p>
<p>All changes done, now start Dovecot daemon</p>
<pre> # cp -v /usr/pkg/share/examples/rc.d/dovecot /etc/rc.d/
 # echo &gt;&gt;/etc/rc.conf 'dovecot=YES' &amp;&amp; /etc/rc.d/dovecot start</pre>
<h2>Postfix SASL support from Dovecot</h2>
<p>This will allow you to authenticate yourself on your server, in order to send mails from outside of your local network (from your portable computer or smartphone, for instance)</p>
<p>Just follow the provided instructions</p>
<pre> # less /usr/pkg/share/doc/dovecot/wiki/HowTo.PostfixAndDovecotSASL.txt</pre>
<p>Just be careful with this postfix line (order is important) :</p>
<pre> smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service inet:127.0.0.1:2525</pre>
<p>(Reload postfix and dovecot of course)</p>
<pre> # /etc/rc.d/postfix reload
 # /etc/rc.d/dovecot reload</pre>
<h2>Installing Apache web server with PHP5</h2>
<pre> # pkgin se apache |less</pre>
<p>We see there are several apache versions to choose from. Go for the latest, Apache 2.4.x</p>
<pre> # pkgin in apache-2.4</pre>
<ul>
<li>The apache user/group is : www/www</li>
<li>The apache daemon is : httpd</li>
<li>Configuration files are located in : /usr/pkg/etc/httpd/</li>
<li>Default document root is : /usr/pkg/share/httpd/htdocs/</li>
<li>Log files are located in : /var/log/httpd/</li>
</ul>
<p>Note 1 : Apache&#8217;s logs will not be rotated by default. You must edit the /etc/newsyslog.conf file and add entries for Apache&#8217;s log files. Also see</p>
<pre> # man newsyslog</pre>
<p>Note 2 : NetBSD comes with its own, small, httpd server (man httpd), which is not enabled by default. /etc/rc.d/httpd is the daemon startup file for this web server whereas Apache uses /etc/rc.d/apache</p>
<p>Copy rc.d init file and start apache (will be started at boot too)</p>
<pre> # cp -v /usr/pkg/share/examples/rc.d/apache /etc/rc.d/
 # echo &gt;&gt;/etc/rc.conf 'apache=YES' &amp;&amp; /etc/rc.d/apache start</pre>
<p>Installing PHP5.3.x for apache</p>
<pre> # pkgin in ap24-php53 php53-suhosin</pre>
<p>Enable suhosin in PHP</p>
<pre> # echo &gt;&gt;/usr/pkg/etc/php.ini 'extension=suhosin.so'</pre>
<p>Configure timezone in PHP</p>
<pre> # echo &gt;&gt;/usr/pkg/etc/php.ini 'date.timezone = Europe/Paris'</pre>
<p>Enable PHP module in apache</p>
<pre> # nano /usr/pkg/etc/httpd/httpd.conf</pre>
<p>Append the lines :</p>
<pre> LoadModule php5_module lib/httpd/mod_php5.so
 AddHandler application/x-httpd-php .php</pre>
<p>And change the line :</p>
<pre> DirectoryIndex index.html</pre>
<p>to</p>
<pre> DirectoryIndex index.html index.php</pre>
<p>Save config, restart apache</p>
<pre> # /etc/rc.d/apache restart</pre>
<p>Verify if PHP is ok</p>
<p><code># cat &gt;/usr/pkg/share/httpd/htdocs/tmpinfo.php &lt;&lt;EOF</code></p>
<p><code>&lt;?php phpinfo(); ?&gt;</code></p>
<p><code>EOF</code></p>
<p>Point your browser at : <a href="http://&lt;server&gt;/tmpinfo.php" rel="nofollow">http://&lt;server&gt;/tmpinfo.php</a></p>
<p>Everything works? Good, now delete the file (security risk)</p>
<pre> # rm /usr/pkg/share/httpd/htdocs/tmpinfo.php</pre>
<p>We could also enable the Apache documentation</p>
<pre> # nano /usr/pkg/etc/httpd/httpd.conf &amp;&amp; /etc/rc.d/apache reload</pre>
<p>Enable the &#8220;negotiation&#8221; module</p>
<pre> LoadModule negotiation_module lib/httpd/mod_negotiation.so</pre>
<p>Then restrict access to the manual to our LAN</p>
<pre> # nano /usr/pkg/etc/httpd/httpd-manual.conf</pre>
<p>Replace the line</p>
<pre> Require all granted</pre>
<p>by</p>
<pre> Require ip 192.168.</pre>
<p>And browse the docs at <a href="http:///manual/" rel="nofollow">http:///manual/</a></p>
<h2>Install Squirrelmail webmail</h2>
<pre> # pkgin in squirrelmail squirrelmail-locales</pre>
<p>Run the configuration script</p>
<pre> # cd /usr/pkg/share/squirrelmail/config &amp;&amp; ./conf.pl</pre>
<p>Important : set your domain name in &#8220;Server settings&#8221;!</p>
<p>Enable some plugins (useful for debugging) : info, message_details, &#8230;</p>
<p>Create a symlink in htdocs</p>
<pre> # ln -s /usr/pkg/share/squirrelmail /usr/pkg/share/httpd/htdocs/</pre>
<p>(or any other name)</p>
<pre> # ln -s /usr/pkg/share/squirrelmail /usr/pkg/share/httpd/htdocs/mail</pre>
<p>We need to enable the gettext extension in php.ini</p>
<pre> # echo &gt;&gt;/usr/pkg/etc/php.ini 'extension=gettext.so'</pre>
<p>And restart apache</p>
<pre> # /etc/rc.d/apache restart</pre>
<p>Now point your browser to : <a href="http:///squirrelmail/" rel="nofollow">http:///squirrelmail/</a> and login with the username and password of your regular user. (root logins are not permitted of course)</p>
<p>You should find in your inbox, the test mail message from root we sent earlier.</p>
<p>Squirrelmail plugins :</p>
<ul>
<li>Compatibility ( <a href="Home mail server with Postfix + Dovecot (IMAP) + Squirrelmail/Roundcube">http://squirrelmail.org/plugin_view.php?id=152</a> ) : needed by other plugins</li>
<li>Lockout ( <a href="http://squirrelmail.org/plugin_view.php?id=200">http://squirrelmail.org/plugin_view.php?id=200</a> ) : Anti bruteforce</li>
<li>Logger ( <a href="http://squirrelmail.org/plugin_view.php?id=52">http://squirrelmail.org/plugin_view.php?id=52</a> ) : Log user activity</li>
</ul>
<pre> # pkgin in wget
 # cd /usr/pkg/share/squirrelmail/plugins/</pre>
<p>(change download links with the latest versions available)</p>
<pre> # wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fcompatibility-2.0.16-1.0.tar.gz -O compatibility.tar.gz
 # tar xvzf compatibility.tar.gz</pre>
<p>Lockout plugin (not required if fail2ban is used)</p>
<pre> # wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Flockout-1.7-1.4.1.tar.gz -O lockout.tar.gz
 # tar xvzf lockout.tar.gz
 # cd lockout/data
 # cp config_example.php config.php
 # nano config.php</pre>
<p>(read carefully and choose your settings!)</p>
<p>Logger plugin (required if you want to use fail2ban!)</p>
<pre> # wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fsquirrel_logger-2.3.1-1.2.7.tar.gz -O logger.tar.gz
 # tar xvzf logger.tar.gz
 # cd squirrel_logger/
 # cp config_example.php config.php
 # nano config.php</pre>
<p>in the <code>"$sl_logs = array ()"</code>, uncomment the <code>'LOGIN_ERROR'</code> line. (this will cause all login errors to be logged in /var/log/maillog)</p>
<p>also set : <code>$sl_use_GMT = 0</code> (required for the fail2ban jail to work)</p>
<p>Activate our new plugins</p>
<pre> # /usr/pkg/share/squirrelmail/config/conf.pl</pre>
<h2>Roundcube webmail (with sqlite backend)</h2>
<pre> # pkgin in sqlite php53-sqlite roundcube</pre>
<p>Enable php extensions as we are told by the packages&#8217; instructions</p>
<p><code># cat &gt;&gt;/usr/pkg/etc/php.ini &lt;&lt;EOF</code></p>
<pre> extension=sqlite.so
 extension=sockets.so
 extension=mysql.so
 extension=mcrypt.so
 extension=mbstring.so
 extension=json.so
 extension=iconv.so
 extension=gd.so
 extension=dom.so
 EOF</pre>
<ul>
<li>Log files: /var/log/roundcube/</li>
<li>Document root: /usr/pkg/share/roundcube/</li>
<li>Docs are in : /usr/pkg/share/doc/roundcube/INSTALL</li>
</ul>
<p>Build pear-MDB2<em>Driver</em>sqlite from source (it&#8217;s missing in the binary packages)</p>
<pre> # cd /root
 # ftp ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2012Q3/pkgsrc.tar.xz
 # tar --xz -xf pkgsrc.tar.xz -C /usr
 # unset PKG_PATH
 # cd /usr/pkgsrc/databases/pear-MDB2_Driver_sqlite
 # make &amp;&amp; make package</pre>
<p>Finally install the generated package</p>
<pre> # pkg_add -v /usr/pkgsrc/packages/All/php53-pear-MDB2_Driver_sqlite-1.5.0b3.tgz</pre>
<p>Setup sqlite database</p>
<pre> # cd /usr/pkg/share/roundcube
 # sqlite -init SQL/sqlite.initial.sql sqlite.db
 .exit</pre>
<p>Now for security purposes we move the database out of the web server&#8217;s documents tree</p>
<pre> # mkdir -p /var/db/roundcube
 # mv sqlite.db /var/db/roundcube
 # chown -R www:www /var/db/roundcube
 # chmod 660 /var/db/roundcube/sqlite.db</pre>
<p>Edit Roundcube configuration</p>
<pre> # nano /usr/pkg/etc/roundcube/db.inc.php

 $rcmail_config['db_dsnw'] = 'sqlite:////var/db/roundcube/sqlite.db?mode=0646'; 
 # nano /usr/pkg/etc/roundcube/main.inc.php

 $rcmail_config['default_host'] = 'localhost';</pre>
<p>Edit roundcube.conf for Apache</p>
<pre> # nano /usr/pkg/etc/roundcube/roundcube.conf

  # Order allow,deny
  # Allow from all
 require all granted
 ...
  # Order deny,allow
  # Deny from all
 require all denied</pre>
<p>Setup Apache</p>
<pre> # echo &gt;&gt;/usr/pkg/etc/httpd/httpd.conf 'Include /usr/pkg/etc/roundcube/roundcube.conf' &amp;&amp; /etc/rc.d/apache reload</pre>
<p>Point your browser to : <a href="http:///roundcube/" rel="nofollow">http:///roundcube/</a> and enjoy the nice webmail interface!</p>
<p>Remember to check /var/log/roundcube/errors in case of problems.</p>
<h2>Enabling SSL in Apache (and other security bits)</h2>
<p>First edit the http-ssl.conf file</p>
<pre> # nano /usr/pkg/etc/httpd/httpd-ssl.conf</pre>
<p>Edit the following lines</p>
<pre> SSLCertificateFile "/etc/ssl/certs/myserver.crt"
 SSLCertificateKeyFile "/etc/ssl/private/myserver.key"</pre>
<p>Then edit the global httpd.conf</p>
<pre> # nano /usr/pkg/etc/httpd/httpd.conf</pre>
<p>Uncomment the following lines</p>
<pre> LoadModule socache_shmcb_module lib/httpd/mod_socache_shmcb.so
 LoadModule ssl_module lib/httpd/mod_ssl.so
 Include etc/httpd/httpd-ssl.conf
 Include etc/httpd/httpd-default.conf</pre>
<p>Change some security defaults as well</p>
<pre> # nano /usr/pkg/etc/httpd/httpd-default.conf 
 ServerTokens Prod
 TraceEnable off</pre>
<p>Also disable PHP signature</p>
<pre> # nano /usr/pkg/etc/php.ini 
 expose_php = Off</pre>
<h2>Enforce https redirection</h2>
<p><a href="http://wiki.apache.org/httpd/RedirectSSL">http://wiki.apache.org/httpd/RedirectSSL</a></p>
<p>You could as well add a list of IP blocks to be denied access to your web server (warning, huge lists will slow down your web server)</p>
<ul>
<li><a href="https://www.countryipblocks.net/country_selection.php">https://www.countryipblocks.net/country_selection.php</a></li>
<li><a href="http://ipinfodb.com/ip_country_block.php">http://ipinfodb.com/ip<em>country</em>block.php</a></li>
<li><a href="http://www.find-ip-address.org/ip-country/">http://www.find-ip-address.org/ip-country/</a></li>
</ul>
<p>Generate an .htaccess deny list and include it in your Apache conf.</p>
<p>Or the opposite, a country whitelist. Example of corresponding Apache 2.4 conf for a whitelist :</p>
<p><code>&lt;Location /&gt;<br />
</code><span class="Apple-style-span" style="font-family:monospace;">&lt;RequireAny&gt;</span></p>
<pre> require all denied
 require local
 require ip 192.168.

 require ip 2.0.0.0/12
 require ip 5.10.128.0/21
 require ip 5.23.40.0/21
 require ip 5.39.224.0/21
 require ip 5.39.232.0/21
 require ip 5.42.152.0/21 ...</pre>
<p><code>&lt;/RequireAny&gt;<br />
</code><span class="Apple-style-span" style="font-family:monospace;">&lt;/Location&gt;</span></p>
<p>Finally</p>
<pre> # /etc/rc.d/apache reload</pre>
<p>Ask the &#8220;kind&#8221; web crawlers not to index our site</p>
<p><code># cat &gt;/usr/pkg/share/httpd/htdocs/robots.txt &lt;&lt;EOF</code></p>
<pre> User-Agent: *
 Disallow: /
 EOF</pre>
<h2>Firewalling</h2>
<p>New firewall in NetBSD 6.0 : npf</p>
<pre> # man npfctl
 # man npf.conf</pre>
<p>Due to my lack of experience with it, I used the pf firewall instead. Here&#8217;s a sample pf firewall configuration :</p>
<p><code># cat &gt;/etc/pf.conf &lt;&lt;EOF</code></p>
<p><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">#<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Generated by Fwbuilder 5.1 and edited<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># replace wm0 with your actual network interface name!<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  0 (wm0)<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># anti spoofing rule<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">block in   log  quick on wm0 inet  from self  to any  label &#8220;RULE 0 &#8212; DROP &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  1 (lo)<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass  quick on lo inet  from any  to any  label &#8220;RULE 1 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># enable the following two rules when using fail2ban<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">table &lt; fail2ban &gt; persist<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">block in quick from &lt; fail2ban &gt; to any label &#8220;fail2ban rule&#8221;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  2 (global)<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># useful ICMP types; ping request<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto icmp  from any  to self icmp-type { 3 , 0 code 0 , 8 code 0 , 11 code 0 , 11 code 1  }  label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># allow SSH in (with connection rate limiting to prevent bruteforcing)<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto tcp  from any  to self port 22 flags any keep state ( max-src-conn-rate 3/30 ) label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># allow SMTP in<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto tcp  from any  to self port 25 flags any  label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># allow IMAP in<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto tcp  from any  to self port 143 flags any  label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># allow HTTP and HTTPS in<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto tcp  from any  to self port 80 flags any  label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass in   quick inet proto tcp  from any  to self port 443 flags any  label &#8220;RULE 2 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  3 (global) :  allow all traffic out<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">pass out  quick inet  from self  to any  label &#8220;RULE 3 &#8212; ACCEPT &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  4 (global) : block all the rest (with logging)<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">block  log  quick inet  from any  to any  label &#8220;RULE 4 &#8212; DROP &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;"># Rule  fallback rule<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">block  quick inet  from any  to any no state  label &#8220;RULE 10000 &#8212; DROP &#8220;<br />
</span></span><span class="Apple-style-span" style="font-family:Times;"><span class="Apple-style-span" style="white-space:normal;">EOF</span></span></p>
<div style="font-family:Times;white-space:normal;"></div>
<pre><span class="Apple-style-span" style="font-family:Times;white-space:normal;">Note : remove the spaces between the "&lt;" "&gt;" signs.</span></pre>
<p>Enable the firewall (and his logging daemon)</p>
<pre> # /etc/rc.d/pf onestart
 # /etc/rc.d/pflogd onestart</pre>
<p>If no error occured, enable the pf firewall (and his logging daemon) at boot</p>
<pre> # echo &gt;&gt;/etc/rc.conf 'pf=YES'
 # echo &gt;&gt;/etc/rc.conf 'pflogd=YES'</pre>
<p>You can review pf&#8217;s log file (binary format) with</p>
<pre> # tcpdump -r /var/log/pflog |tail</pre>
<p>Note : /var/log/pflog can grow fast!</p>
<h2>Fail2ban on NetBSD</h2>
<p>Thanks to : <a href="http://www.bsdguides.org/2012/fail2ban-with-pf-on-openbsd-5-2">http://www.bsdguides.org/2012/fail2ban-with-pf-on-openbsd-5-2</a></p>
<p>Download and install the latest Fail2ban release</p>
<pre> # wget https://github.com/fail2ban/fail2ban/archive/master.zip --no-check-certificate
 # unzip master.zip
 # cd fail2ban-master
 # python2.7 setup.py install</pre>
<p>Create a new pf.conf action file for fail2ban</p>
<p><code># cat &gt;/etc/fail2ban/action.d/pf.conf &lt;&lt;EOF</code></p>
<pre> [Definition]
 actionstart = 
 actionstop =
 actioncheck =
 actionban = /sbin/pfctl -t fail2ban -T add &lt; ip &gt;/32 
 actionunban = /sbin/pfctl -t fail2ban -T del &lt; ip &gt;/32
 [Init]
 EOF</pre>
<p>Note : remove the spaces between the &#8220;&lt;&#8221; &#8220;&gt;&#8221; signs.</p>
<p>And add the following jails in a new jail.local file</p>
<p><code># cat &gt;/etc/fail2ban/jail.local &lt;&lt;EOF</code></p>
<pre> # NetBSD jails with PF firewall 
[DEFAULT]
 ignoreip = 127.0.0.1/8 192.168.0.0/16
 bantime = 600
 findtime = 600
 maxretry = 5

 [ssh-pf]
 enabled = true
 filter = sshd
 action = pf[name="ssh-pf"]
 sendmail-whois[name="ssh-pf", dest=root]
 logpath = /var/log/authlog

 # Note for dovecot : will not block squirrelmail bruteforce attacks (localhost ip ignored), only external attacks.
 [dovecot-pf]
 enabled = true
 filter = dovecot
 action = pf[name="dovecot-pf"]
 sendmail-whois[name="dovecot-pf", dest=root]
 logpath = /var/log/maillog

 [postfix-pf]
 enabled = true
 filter = postfix
 action = pf[name="postfix-pf"]
 sendmail-whois[name="postfix-pf", dest=root]
 logpath = /var/log/maillog

 [sasl-pf]
 enabled = true
 filter = sasl
 action = pf[name="sasl-pf"]
 sendmail-whois[name="sasl-pf", dest=root]
 logpath = /var/log/maillog

 # inspired from : http://mattrude.com/projects/roundcube-fail2ban-plugin/
 [roundcube-pf]
 enabled = true
 filter = roundcube
 action = pf[name="roundcube-pf"]
 sendmail-whois[name="roundcube-pf", dest=root]
 logpath = /var/log/roundcube/errors

 [squirrelmail-pf]
 enabled = true
 filter = squirrelmail
 action = pf[name="squirrelmail-pf"]
 sendmail-whois[name="squirrelmail-pf", dest=root]
 logpath = /var/log/maillog

 # end of jails
 EOF</pre>
<p>Create the roundcube.conf filter</p>
<p><code># cat &gt;/etc/fail2ban/filter.d/roundcube.conf &lt;&lt;EOF</code></p>
<pre> [Definition]
 failregex = .*Login failed for .*. from &lt; HOST &gt;
 ignoreregex =
 EOF</pre>
<p>Note : remove the spaces between the &#8220;&lt;&#8221; &#8220;&gt;&#8221; signs.</p>
<p>And the squirrelmail.conf filter</p>
<p><code># cat &gt;/etc/fail2ban/filter.d/squirrelmail.conf &lt;&lt;EOF</code></p>
<pre> [Definition]
 failregex = .*Failed webmail login: by .*. at &lt; HOST &gt; on .*.: Unknown user or password incorrect.
 ignoreregex =
 EOF</pre>
<p>Note : remove the spaces between the &#8220;&lt;&#8221; &#8220;&gt;&#8221; signs.</p>
<p>Note : comment the &#8220;::1 localhost&#8221; line in /etc/hosts. Dovecot jail may not work correctly otherwise.</p>
<p>Let&#8217;s install gamin (file alteration monitor) so that fail2ban will use it instead of the &#8220;polling&#8221; backend</p>
<pre> # pkgin in gamin</pre>
<p>To start fail2ban at boot, we create a corresponding rc script</p>
<p><code># cat &gt;/etc/rc.d/fail2ban &lt;&lt;EOF</code></p>
<pre> #!/bin/sh
 #
 # fail2ban rc script for NetBSD
 #
 # PROVIDE: fail2ban
 # REQUIRE: DAEMON
 # BEFORE: LOGIN
 # KEYWORD : shutdown

 if [ -f /etc/rc.subr ]; then
  . /etc/rc.subr
 fi

 name="fail2ban"
 rcvar=${name}
 command="/usr/pkg/bin/fail2ban-client"
 command_args="-x"

 if [ ! -d /var/run/fail2ban ]; then
  mkdir /var/run/fail2ban/
 fi

 echo -n " ${name}: "
 ${command} ${command_args} "$1"

 EOF</pre>
<p>And set in rc.conf</p>
<pre> # echo &gt;&gt;/etc/rc.conf 'fail2ban=YES'</pre>
<p>Finally start fail2ban</p>
<pre> # /etc/rc.d/fail2ban start</pre>
<p>or</p>
<pre> # fail2ban-client start</pre>
<p>Now test your jails!</p>
<p>TODO : (FIX) old bans come up again after fail2ban restart! log rotation related?</p>
<h2>Tips</h2>
<p>Verify the banned ip&#8217;s in the &#8220;fail2ban&#8221; pf table</p>
<pre> # pfctl -t fail2ban -T show</pre>
<p>Manually unban an ip</p>
<pre> # fail2ban-client set &lt;jail&gt; unbanip &lt;ip&gt;</pre>
<p>Test a regex</p>
<pre> # fail2ban-regex /var/log/maillog /etc/fail2ban/filter.d/squirrelmail.conf</pre>
<h1>Security</h1>
<pre> # man security</pre>
<p>Check daily for security updates</p>
<pre> # echo &gt;&gt;/etc/daily.conf 'fetch_pkg_vulnerabilities=YES'</pre>
<p>For creating your next mail users (with disabled shell access)</p>
<pre> # useradd -m -s /sbin/nologin mynewuser &amp;&amp; passwd mynewuser</pre>
<p><em>* USE STRONG PASSWORDS! (AGAIN!) *</em></p>
<h1>System monitoring</h1>
<p>Show processes</p>
<pre> # top -ac</pre>
<p>Show listening network ports</p>
<pre> # netstat -an|less</pre>
<p>By default, NetBSD will run a daily cron job (/etc/daily) which includes a complete system security check (/etc/security). Mail reports will be sent to root.</p>
<pre> # crontab -l
 # man daily</pre>
<p>Postfix stats with pflogsumm</p>
<pre> # pkgin in pflogsumm</pre>
<p>example of use</p>
<pre> # zcat /var/log/maillog*.gz |pflogsumm</pre>
<h2>Mailgraph for postfix</h2>
<pre> # pkgin in mailgraph
 # cp -v /usr/pkg/share/examples/rc.d/mailgraph /etc/rc.d/</pre>
<p>rc file needs some changes</p>
<pre> # nano /etc/rc.d/mailgraph</pre>
<p>command_args=&#8221;-d -l /var/log/maillog&#8221;</p>
<pre> # mkdir -p /var/db/mailgraph
 # echo &gt;&gt;/etc/rc.conf 'mailgraph=YES' &amp;&amp; /etc/rc.d/mailgraph start</pre>
<p>We need to make sure Apache can run cgi&#8217;s</p>
<pre> # nano /usr/pkg/etc/httpd/httpd.conf &amp;&amp; /etc/rc.d/apache reload</pre>
<p>uncomment the lines :</p>
<pre> LoadModule cgid_module lib/httpd/mod_cgid.so Scriptsock cgisock</pre>
<p>Now point your browser at : <a href="http://&lt;server&gt;/cgi-bin/mailgraph.cgi" rel="nofollow">http://&lt;server&gt;/cgi-bin/mailgraph.cgi</a></p>
<p>TODO : FIX : no graphics displayed!</p>
<h2>Web server stats with Webalizer (AWStats is also available)</h2>
<pre> # pkgin in webalizer</pre>
<p>Create output directory in our htdocs</p>
<pre> # mkdir /usr/pkg/share/httpd/htdocs/webalizer/</pre>
<p>Edit webalizer conf</p>
<pre> # nano /usr/pkg/etc/webalizer.conf 
LogFile        /var/log/httpd/access_log
OutputDir      /usr/pkg/share/httpd/htdocs/webalizer/
PageType        htm*
PageType        cgi
PageType        php*
PageType        pl
DNSCache        dns_cache.db
DNSChildren     5
HTMLBody &lt;BODY BGCOLOR="white" TEXT="black"&gt;
AllSites        yes
AllURLs         yes
AllReferrers    yes
AllAgents       yes
AllSearchStr    yes
AllUsers        yes
HideSite        *domain.tld
HideSite        localhost
HideReferrer    domain.tld/
HideReferrer    localhost
HideURL         *.gif
HideURL         *.GIF
HideURL         *.jpg
HideURL         *.JPG
HideURL         *.png
HideURL         *.PNG
ColorHit        B1D28F
ColorFile       E3AD00
ColorSite       FFEB55
ColorKbyte      FF80DF
ColorPage       80B3FF
ColorVisit      638000
ColorMisc       EEEEEE</pre>
<p>The rest of the settings are defaults.</p>
<p>Now generate stats</p>
<pre> # webalizer</pre>
<p>Restrict access to the webalizer generated files, to the LAN only</p>
<pre> # nano /usr/pkg/etc/httpd/httpd.conf &amp;&amp; /etc/rc.d/apache reload</pre>
<p>Append the following lines</p>
<p><code>&lt;Directory "/usr/pkg/share/httpd/htdocs/webalizer"&gt;</code></p>
<p><code>Require ip 192.168.</code></p>
<p><code>&lt;/Directory&gt;</code></p>
<p>You might want to add a cronjob</p>
<pre> # crontab -e

 0 0 * * * /usr/pkg/bin/webalizer -Q</pre>
<h2>Munin</h2>
<pre> # pkgin in munin-server munin-node</pre>
<p>TODO!</p>
<p>Finally, test your mail server with some nice online tools</p>
<ul>
<li><a href="http://www.emailsecuritygrader.com/">http://www.emailsecuritygrader.com/</a></li>
<li><a href="http://dnsgoodies.com/">http://dnsgoodies.com/</a></li>
<li><a href="http://viewdns.info/dnsreport/">http://viewdns.info/dnsreport/</a></li>
<li><a href="http://mxtoolbox.com">http://mxtoolbox.com</a></li>
</ul>
<p>(hint: try these tools with both cases: fail2ban enabled or disabled)</p>
<h1>Conclusion</h1>
<p>Please report any mistakes, suggestions, ideas for improvement&#8230; Thanks!</p>
<h1>TIPS</h1>
<p>Remove user from the wheel group : We need to first delete the user (while preserving his home directory and files!)</p>
<pre> # userdel -v fred</pre>
<p>And add him again (not recreating his home directory)</p>
<pre> # adduser fred
 # passwd fred</pre>
<p>If you decide your UNIX users should not be be able to log in to a shell</p>
<pre> # chsh -s /sbin/nologin fred</pre>
<p>Beware : not to lock yourself out of a remote system! (Remember ssh root login is not allowed by default)</p>
<p>Verify with</p>
<pre> # user info fred</pre>
<p>Stopping/rebooting the system cleanly</p>
<pre> # shutdown -p now
 # shutdown -r now</pre>
<h1>Reference links</h1>
<ul>
<li><a href="http://www.netbsd.org/docs/guide/en/index.html">http://www.netbsd.org/docs/guide/en/index.html</a></li>
<li><a href="http://www.cyberciti.biz/faq/howto-pf-firewall-list-firewall-rules/">http://www.cyberciti.biz/faq/howto-pf-firewall-list-firewall-rules/</a></li>
<li><a href="http://pkgsrc.se/">http://pkgsrc.se/</a></li>
</ul>
<h1>TODO</h1>
<ul>
<li>DKIM / <a href="http://wiki.auto-hebergement.fr/services/dkim" rel="nofollow">http://wiki.auto-hebergement.fr/services/dkim</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/193/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=193&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2013/01/06/home-mail-server-with-postfix-dovecot-imap-squirrelmailroundcube-on-netbsd-6-0-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2013/01/netbsd-smaller-tb.png" medium="image">
			<media:title type="html">NetBSD-smaller-tb</media:title>
		</media:content>
	</item>
		<item>
		<title>Wireless Ad-hoc server script</title>
		<link>http://agentoss.wordpress.com/2012/11/08/wireless-ad-hoc-server-script/</link>
		<comments>http://agentoss.wordpress.com/2012/11/08/wireless-ad-hoc-server-script/#comments</comments>
		<pubDate>Thu, 08 Nov 2012 18:14:02 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Arch]]></category>
		<category><![CDATA[Bash scripts]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sharing]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=189</guid>
		<description><![CDATA[Today, a quick and dirty Bash script which will allow you, for instance, to quickly serve files from your laptop to other wireless devices (Warning here, we use WEP encryption which is not secure). #!/bin/bash # # Wireless Ad-hoc script # # http://agentoss.wordpress.com / fredo696@gmail.com # # This script will setup your wireless adapter in [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=189&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today, a quick and dirty Bash script which will allow you, for instance, to quickly serve files from your laptop to other wireless devices (Warning here, we use WEP encryption which is not secure).</p>
<p><code><br />
#!/bin/bash<br />
#<br />
# Wireless Ad-hoc script<br />
#<br />
# <a href="http://agentoss.wordpress.com" rel="nofollow">http://agentoss.wordpress.com</a> / <a href="mailto:fredo696@gmail.com">fredo696@gmail.com</a><br />
#<br />
# This script will setup your wireless adapter in Ad-Hoc mode<br />
# and start a DHCP server so that other peers (eg. an Android device)<br />
# can receive an IP address and connect to your computer.<br />
#<br />
# After that, you can start a minimal webserver (darkhttpd for example)<br />
# so that you can quickly share some files with minimal effort!<br />
#<br />
# This script must be run as root.<br />
# Tested on Arch Linux.<br />
# Some adaptations may be needed for other Linux systems.<br />
#<br />
# Requirements: iw, ifconfig commands, and dnsmasq.<br />
#<br />
# WARNING : WEP encryption is weak security <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p># User variables<br />
mywlan="wlan0"<br />
myessid="fredo"<br />
mychan="4"<br />
mywepkey="dead-beef-00"<br />
myip="192.168.7.100"<br />
mydhcprange="192.168.7.101,192.168.7.110"</p>
<p># Main program<br />
echo -n "Stopping wireless connections (if any)... "<br />
# adapt to your system; I use wicd<br />
systemctl stop wicd &amp;&amp; echo "OK"<br />
# for networkmanager<br />
#systemctl stop NetworkManager</p>
<p>echo -n "Starting wireless Ad-hoc mode... "<br />
ifconfig $mywlan down || exit 1<br />
iwconfig $mywlan mode ad-hoc || exit 1<br />
iwconfig $mywlan essid $myessid<br />
iwconfig $mywlan channel $mychan<br />
[ "$mywepkey" ] &amp;&amp; iwconfig $mywlan key $mywepkey</p>
<p>ifconfig $mywlan $myip<br />
ifconfig $mywlan up &amp;&amp; echo "OK"<br />
echo -n "Starting DHCP server ... "<br />
dnsmasq --dhcp-range="$mydhcprange" &amp;&amp; echo "OK"</p>
<p>echo "--------------------------------------"<br />
echo "ESSID : $myessid"<br />
[ "$mywepkey" ] &amp;&amp; echo "WEP KEY : $mywepkey"<br />
echo "This computer's IP : $myip"<br />
echo "--------------------------------------"</p>
<p># debug<br />
#iwconfig $mywlan</p>
<p>while true; do<br />
 echo -n "Enter 'q' to quit. "<br />
 read value<br />
 if [ "$value" == "q" ]; then<br />
  break<br />
 fi<br />
done</p>
<p>echo -n "Killing DHCP server... "<br />
killall dnsmasq &amp;&amp; echo "OK"<br />
echo -n "Killing wireless... "<br />
# restoring the wlan interface to "default" mode<br />
ifconfig $mywlan down<br />
iwconfig $mywlan mode managed<br />
iwconfig $mywlan essid off<br />
iwconfig $mywlan key off<br />
echo "OK"<br />
echo "Wireless Ad-hoc mode terminated."<br />
# now you can restart your network manager</p>
<p>exit 0<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=189&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/11/08/wireless-ad-hoc-server-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux Slackware 14.0 (64 bits) quick setup</title>
		<link>http://agentoss.wordpress.com/2012/09/30/linux-slackware-14-0-64-bits-quick-setup/</link>
		<comments>http://agentoss.wordpress.com/2012/09/30/linux-slackware-14-0-64-bits-quick-setup/#comments</comments>
		<pubDate>Sun, 30 Sep 2012 18:16:15 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[slackware]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=181</guid>
		<description><![CDATA[http://www.slackware.com/ System used for this howto : VirtualBox 4.2 virtual machine, with 2 cpu&#8217;s 1024Mb RAM 20Gb Hard disk Installation Download the official (64 bit) DVD iso http://www.slackware.com/torrents/slackware64-14.0-install-dvd.torrent Boot the DVD Select your keyboard map, login as &#8220;root&#8221;. Create your partitions (I use cfdisk) # cfdisk /dev/sda First partition (/dev/sda1) : swap (use at least [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=181&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div>
<div id="attachment_185" class="wp-caption aligncenter" style="width: 310px"><a href="http://agentoss.files.wordpress.com/2012/09/slackware-14.png"><img class="size-medium wp-image-185" title="Slackware 14" src="http://agentoss.files.wordpress.com/2012/09/slackware-14.png?w=300&#038;h=218" alt="Slackware 14.0 (XFCE)" width="300" height="218" /></a><p class="wp-caption-text">Slackware 14.0 (XFCE desktop)</p></div>
</div>
<div></div>
<div style="text-align:center;"><a href="http://www.slackware.com/">http://www.slackware.com/</a></div>
<div></div>
<div></div>
<div>System used for this howto :</div>
<div></div>
<div>VirtualBox 4.2 virtual machine, with</div>
<div>2 cpu&#8217;s</div>
<div>1024Mb RAM</div>
<div>20Gb Hard disk</div>
<div></div>
<div></div>
<h1>Installation</h1>
<div></div>
<div>Download the official (64 bit) DVD iso</div>
<div></div>
<div><a href="http://www.slackware.com/torrents/slackware64-14.0-install-dvd.torrent">http://www.slackware.com/torrents/slackware64-14.0-install-dvd.torrent</a></div>
<div></div>
<div>Boot the DVD</div>
<div></div>
<div>Select your keyboard map, login as &#8220;root&#8221;.</div>
<div>Create your partitions (I use cfdisk)</div>
<pre># cfdisk /dev/sda</pre>
<div></div>
<div>First partition (/dev/sda1) : swap</div>
<div>(use at least the same size as your RAM for suspend-to-disk to work)</div>
<div>Second (bootable) partition (/dev/sda2) : Linux</div>
<div></div>
<div>Start the installer</div>
<pre># setup</pre>
<div></div>
<div>Go to ADDSWAP and follow the steps. For my Linux root partition I use ext4 as filesystem.</div>
<div></div>
<div>Package selection</div>
<div></div>
<div>I choose Default, but personally deselect &#8220;GNU Emacs&#8221;, &#8220;TeX&#8221; and &#8220;Games&#8221; as I don&#8217;t use them.</div>
<div>We will install KDE international language later.</div>
<div></div>
<div>Select prompting mode. I select &#8220;terse&#8221; which is faster.</div>
<div></div>
<div>Default choices are used for the rest of the installation steps.</div>
<div></div>
<div>End of installation</div>
<pre># reboot</pre>
<div></div>
<div></div>
<h1>Post-installation configuration</h1>
<div></div>
<div></div>
<div>Note : root login is permitted by ssh in the default Slackware installation.</div>
<div></div>
<div>First login on the system, login as root, then check your mail</div>
<pre># mail</pre>
<div>or even better, use mutt</div>
<pre># mutt</pre>
<div></div>
<h2>Setup Slackpkg and update your freshly installed system</h2>
<div></div>
<div>Select your mirror</div>
<pre># nano /etc/slackpkg/mirrors</pre>
<div>Uncomment ONE mirror.</div>
<pre># slackpkg update
# slackpkg upgrade-all</pre>
<div></div>
<div></div>
<h2>Set the system locale</h2>
<div></div>
<div>Show list of supported locales</div>
<pre># locale -a</pre>
<div>Then set it (changes will be effective after a reboot)</div>
<pre># nano /etc/profile.d/lang.sh</pre>
<div>(here for french systems)</div>
<div></div>
<pre>export LANG=fr_FR.utf8</pre>
<div></div>
<div>(Do the same for /etc/profile.d/lang.csh if you use the tcsh shell)</div>
<div></div>
<div></div>
<div>Add your KDE international language (here french for me).</div>
<div>Note: installing the KDE environment will also install the Calligra office suite.</div>
<pre># slackpkg search l10n</pre>
<div>then</div>
<pre># slackpkg install kde-l10n-fr calligra-l10n-fr</pre>
<div></div>
<div>Note 1 : you&#8217;ll have to select the language to use in KDE&#8217;s system settings (look under Locale).</div>
<div></div>
<div>Note 2 : the language pack in XFCE will be automatically detected after you set the systemwide locale.</div>
<div></div>
<div></div>
<h2>Sendmail</h2>
<div></div>
<div>Note : your system should have a valid DNS name otherwise email relaying will be refused ( &#8220;Sender address rejected: Domain not found&#8221; ).</div>
<div></div>
<div>Use netconfig to reconfigure hostname and domain if needed</div>
<pre># netconfig</pre>
<div></div>
<div>Configure the MTA so that the system can send outgoing mail to the internet.</div>
<div>We will use our ISP&#8217;s SMTP smarthost. For this we need to generate a new sendmail.cf configuration file</div>
<pre># cd /usr/share/sendmail/cf/cf
# nano sendmail-slackware.mc</pre>
<div></div>
<div>Uncomment the SMART_HOST define :</div>
<div>replace</div>
<pre>dnl define(`SMART_HOST',`mailserver.example.com')</pre>
<div></div>
<div>by</div>
<div></div>
<pre>define(`SMART_HOST',`smtp.yourisp.com')</pre>
<div></div>
<div>Save changes and build the config file</div>
<pre># ./Build sendmail-slackware.mc</pre>
<div>Copy the generated .cf file to sendmail&#8217;s directory</div>
<pre># cp sendmail-slackware.cf /etc/mail/sendmail.cf</pre>
<div></div>
<div>Now start sendmail (also this way sendmail will be automatically started on boot, Slackware-style)</div>
<pre># chmod +x /etc/rc.d/rc.sendmail
# /etc/rc.d/rc.sendmail start</pre>
<div></div>
<div>Send an email for testing</div>
<pre># echo 'from my Slackware box'| mail -s 'Hello' my@address.com</pre>
<div>See the logs to see if everything goes well</div>
<pre># tail /var/log/maillog</pre>
<div></div>
<div>Forward root mail</div>
<div>We create a .forward file in root&#8217;s home so that emails sent to root@localhost will be forwarded to another address (useful for cron jobs and daemons)</div>
<pre># echo &gt;/root/.forward my@address.com</pre>
<div>(several different addresses can be added to the file, one per line)</div>
<div></div>
<div>Test the forwarding</div>
<pre># echo 'from my Slackware box'| mail -s 'Forwarding' root@localhost</pre>
<div></div>
<h2>X.Org systemwide keyboard settings</h2>
<div></div>
<div>You can setup keyboard layout in KDE or XFCE settings. If you prefer to set it up systemwide, just create the file :</div>
<pre># nano /etc/X11/xorg.conf.d/10-evdev.conf</pre>
<div></div>
<pre>Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        option "xkblayout"      "fr"
EndSection</pre>
<div></div>
<div></div>
<h2>Virtualbox guest additions (optional, only if running in a VM)</h2>
<div></div>
<div>It&#8217;s easy to do since Slackware&#8217;s default install includes a standard development environment and the kernel source.</div>
<div>(First mount the VirtualBox Additions cdrom)</div>
<pre># mount /dev/sr0 /mnt/tmp
# sh /mnt/tmp/VBoxLinuxAdditions.run</pre>
<div></div>
<div></div>
<h2>Create a regular user &#8220;fred&#8221;</h2>
<div></div>
<pre># adduser fred</pre>
<div></div>
<div>Additional groups (press the UP arrow key) : audio cdrom floppy plugdev video power netdev lp scanner</div>
<div></div>
<div></div>
<h2>Graphical login</h2>
<div></div>
<div>Edit the /etc/inittab</div>
<pre># nano /etc/inittab</pre>
<div></div>
<div>change</div>
<div>id:3:initdefault:</div>
<div>to</div>
<div>id:4:initdefault:</div>
<div></div>
<div></div>
<div>Comment out some ttys while we are at it (will save some memory)</div>
<div></div>
<div>c1:12345:respawn:/sbin/agetty &#8211;noclear 38400 tty1 linux</div>
<div>c2:12345:respawn:/sbin/agetty 38400 tty2 linux</div>
<div>c3:12345:respawn:/sbin/agetty 38400 tty3 linux</div>
<div>#c4:12345:respawn:/sbin/agetty 38400 tty4 linux</div>
<div>#c5:12345:respawn:/sbin/agetty 38400 tty5 linux</div>
<div>#c6:12345:respawn:/sbin/agetty 38400 tty6 linux</div>
<div></div>
<div></div>
<div></div>
<div>Save changes, reboot.</div>
<div></div>
<div>Now you should be presented to the default session manager (KDM or XDM if you did not install KDE)</div>
<div></div>
<div></div>
<div></div>
<h2>Install additional software</h2>
<div></div>
<div>Surprise! There&#8217;s an &#8220;extra&#8221; directory on the DVD! It contains some popular applications :</div>
<div>Chromium web browser, Java, Flash player plugin, &#8230;</div>
<div></div>
<div>Just open a terminal and read the TXT file (README) for instructions.</div>
<div></div>
<div>Note: the flashplayer-plugin slackbuild found on the DVD does not work (outdated flash player version no more available for download).</div>
<div></div>
<div>Or just copy extra/flashplayer-plugin/* files to /tmp, edit the .slackbuild file</div>
<pre># nano flashplayer-plugin.SlackBuild</pre>
<div>replace</div>
<div>VERSION=${VERSION:-&#8221;11.2.202.236&#8243;}</div>
<div>by</div>
<div>VERSION=${VERSION:-&#8221;11.2.202.238&#8243;}</div>
<div></div>
<div>Save changes and run the slackbuild</div>
<pre># sh flashplayer-plugin.SlackBuild</pre>
<div>Install the generated package</div>
<pre># installpkg /tmp/flashplayer-plugin-11.2.202.238-x86_64-1alien.txz</pre>
<div></div>
<div>Also, as an alternative, the slackbuild found on slackbuilds.org will work ( <a href="http://slackbuilds.org/repository/13.37/multimedia/flash-player-plugin/">http://slackbuilds.org/repository/13.37/multimedia/flash-player-plugin/</a> ).</div>
<div></div>
<div></div>
<div></div>
<h2>Additional software from 3rd party packages</h2>
<div></div>
<div>(versions are likely to change since the writing of this document)</div>
<div></div>
<div>VLC (from AlienBob&#8217;s repository)</div>
<div>(as root)</div>
<pre># cd
# wget http://slackware.org.uk/people/alien/restricted_slackbuilds/vlc/pkg64/14.0/vlc-2.0.3-x86_64-1alien.txz
# installpkg vlc*</pre>
<div></div>
<div>LibreOffice (from RlWorkman&#8217;s repository)</div>
<pre># wget http://www.rlworkman.net/pkgs/14.0/x86_64/libreoffice-3.6.1_en_US-x86_64-1_rlw.txz
# installpkg libreoffice*</pre>
<div></div>
<div>Note : the language packs are not included.</div>
<div>AlienBob also has LibreOffice packages (including the language packs), just wait for some days for the updated packages for Slackware 14.0 to appear <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div><a href="http://www.slackware.org.uk/people/alien/slackbuilds/libreoffice/">http://www.slackware.org.uk/people/alien/slackbuilds/libreoffice/</a></div>
<div></div>
<div></div>
<h2>Filesystem optimizations</h2>
<div></div>
<pre># nano /etc/fstab</pre>
<div></div>
<div>Add the &#8220;noatime&#8221; option for the rootfs.</div>
<div></div>
<div>/dev/sda2        /                ext4        defaults,noatime         1   1</div>
<div></div>
<div>Add /tmp in tmpfs</div>
<div></div>
<div>tmpfs           /tmp            tmpfs           defaults,nosuid,nodev   0       0</div>
<div></div>
<div></div>
<div></div>
<h2>Generic Kernel, faster boot and resume from hibernation</h2>
<div></div>
<div>Generate an initramfs</div>
<pre># /usr/share/mkinitrd/mkinitrd_command_generator.sh -r</pre>
<div>Copy the result to your command prompt and execute it</div>
<div>(in my case)</div>
<pre># mkinitrd -c -k 3.2.29 -f ext4 -r /dev/sda2 -m mbcache:jbd2:ext4 -u -o /boot/initrd.gz</pre>
<div></div>
<div>Then update lilo&#8217;s (bootloader) configuration</div>
<pre># nano /etc/lilo.conf</pre>
<div></div>
<div>- add the &#8220;compact&#8221; directive (will gain some boot speed) at the beginning</div>
<div>- decrease the &#8220;timeout&#8221; value to your liking (a value of 50 should be enough)</div>
<div>- add a &#8220;default&#8221; directive for our new kernel entry :</div>
<div></div>
<pre>default=Linux-generic</pre>
<div></div>
<div>then add a new kernel entry at the end</div>
<div></div>
<pre>image= /boot/vmlinuz-generic-3.2.29
root=/dev/sda2
  initrd = /boot/initrd.gz
  label = Linux-generic
  read-only
  append="quiet fastboot resume=/dev/sda1"</pre>
<div></div>
<div>Save changes, make sure lilo is executed to update the bootloader code</div>
<pre># lilo -v</pre>
<div></div>
<div>Then reboot. Less messages, (a little) faster boot times <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div>Be sure to test suspend-to-disk (hibernate) and system resume.</div>
<div></div>
<div></div>
<h2>Firewalling</h2>
<div></div>
<div>By default, no firewall is configured at all.</div>
<pre># iptables -L</pre>
<div></div>
<div>We can generate a simple firewall configuration from this website : <a href="http://www.mista.nu/iptables/">http://www.mista.nu/iptables/</a></div>
<div>Then copy and paste our generated firewall to /etc/rc.d/rc.firewall</div>
<div></div>
<div>(the generated config needs some adjustments, like the path to the iptables executable in the IPT variable)</div>
<div></div>
<pre>#!/bin/sh
# iptables script generated 2012-09-30
# http://www.mista.nu/iptables
IPT="/usr/sbin/iptables"
# Flush old rules, old custom tables
$IPT --flush
$IPT --delete-chain
# Set default policies for all three default chains
$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT ACCEPT
# Enable free use of loopback interfaces
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
# All TCP sessions should begin with SYN
$IPT -A INPUT -p tcp ! --syn -m state --state NEW -s 0.0.0.0/0 -j DROP
# Accept inbound TCP packets
$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# SMTP
#$IPT -A INPUT -p tcp --dport smtp -m state --state NEW -s 0.0.0.0/0 -j ACCEPT
# HTTP
#$IPT -A INPUT -p tcp --dport http -m state --state NEW -s 0.0.0.0/0 -j ACCEPT
# HTTPS
#$IPT -A INPUT -p tcp --dport https -m state --state NEW -s 0.0.0.0/0 -j ACCEPT
# SSH
$IPT -A INPUT -p tcp --dport ssh -m state --state NEW -s 0.0.0.0/0 -j ACCEPT
# Accept inbound ICMP messages
$IPT -A INPUT -p ICMP --icmp-type 8 -s 0.0.0.0/0 -j ACCEPT
$IPT -A INPUT -p ICMP --icmp-type 11 -s 0.0.0.0/0 -j ACCEPT
# EOF</pre>
<p>Start firewall at boot</p>
<pre># chmod +x /etc/rc.d/rc.firewall</pre>
<div></div>
<div>If you want to disable the firewall</div>
<pre># iptables -F</pre>
<div>To disable at boot time</div>
<pre># chmod -x /etc/rc.d/rc.firewall</pre>
<div></div>
<div></div>
<h1>That&#8217;s it!</h1>
<div></div>
<div></div>
<div></div>
<h1>TIPS</h1>
<div></div>
<div>Read the TXT files on the DVD! Lots of useful info for special setups (encrypted, lvm/raid, etc)</div>
<div></div>
<div>Need to boot in single user mode (useful for rescue)?</div>
<div>Append &#8220;S&#8221; to your kernel line at boot time.</div>
<div></div>
<div>Need to reconfigure your system?</div>
<pre># pkgtool</pre>
<div></div>
<div>Want to change the default desktop environment?</div>
<pre># xwmconfig</pre>
<div></div>
<div>Want to change the default X session manager?</div>
<pre># chmod -x /usr/bin/kdm</pre>
<div>This will use XDM instead of KDM as the default session manager</div>
<div></div>
<div></div>
<h1>Useful links</h1>
<div></div>
<div>Official Slackware wiki</div>
<div><a href="http://docs.slackware.com">http://docs.slackware.com</a></div>
<div></div>
<div>Packages list</div>
<div><a href="http://packages.slackware.com/">http://packages.slackware.com/</a></div>
<div></div>
<div>SlackBuilds</div>
<div><a href="http://slackbuilds.org/">http://slackbuilds.org/</a></div>
<div></div>
<div>AlienBob&#8217;s packages</div>
<div><a href="http://www.slackware.org.uk/people/alien/slackbuilds/">http://www.slackware.org.uk/people/alien/slackbuilds/</a></div>
<div><a href="http://www.slackware.org.uk/people/alien/restricted_slackbuilds/">http://www.slackware.org.uk/people/alien/restricted_slackbuilds/</a></div>
<div></div>
<div>Rlworkman&#8217;s packages</div>
<div><a href="http://rlworkman.net/pkgs/">http://rlworkman.net/pkgs/</a></div>
<div></div>
<div>Great sendmail howto</div>
<div><a href="http://www.wikihow.com/Configure-Sendmail">http://www.wikihow.com/Configure-Sendmail</a></div>
<div></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=181&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/09/30/linux-slackware-14-0-64-bits-quick-setup/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2012/09/slackware-14.png?w=300" medium="image">
			<media:title type="html">Slackware 14</media:title>
		</media:content>
	</item>
		<item>
		<title>Frugalware Linux 1.7 on Panasonic Toughbook CF-T8 laptop</title>
		<link>http://agentoss.wordpress.com/2012/09/07/frugalware-linux-1-7-on-panasonic-toughbook-cf-t8-laptop/</link>
		<comments>http://agentoss.wordpress.com/2012/09/07/frugalware-linux-1-7-on-panasonic-toughbook-cf-t8-laptop/#comments</comments>
		<pubDate>Fri, 07 Sep 2012 14:50:40 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[frugalware]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[panasonic]]></category>
		<category><![CDATA[toughbook]]></category>
		<category><![CDATA[xfce]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=173</guid>
		<description><![CDATA[System specs http://business.panasonic.co.uk/computer-product/products-and-services/business-ruggedized/cf-t8  (Mine is a CF-T8 mk3 model) Installation (base system) Download the 64bits iso : ftp://ftp2.frugalware.org/mirror/ftp.frugalware.org/pub/frugalware//frugalware-1.7-iso/frugalware-1.7-x86_64-cd1.iso Dump the iso to an usb drive (WARNING! WILL ERASE EVERYTHING ON DESTINATION DRIVE!) # dd if=frugalware*.iso of=/dev/sdX bs=1M (replace sdX with your actual drive) Boot from usb. Unfortunately the GUI installer will not work, so we [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=173&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<div><a href="http://www.frugalware.org"><img class="size-full wp-image-177 alignleft" title="frugalwarelogo" src="http://agentoss.files.wordpress.com/2012/09/frugalwarelogo.png?w=869" alt=""   /></a></div>
<div></div>
<div></div>
<div></div>
<div><a href="http://agentoss.files.wordpress.com/2012/09/toughbook-t8-9-500x500.jpg"><img class="size-medium wp-image-176 alignright" title="toughbook-t8-9-500x500" src="http://agentoss.files.wordpress.com/2012/09/toughbook-t8-9-500x500.jpg?w=300&#038;h=300" alt="" width="300" height="300" /></a></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div>System specs</div>
<div><a href="http://business.panasonic.co.uk/computer-product/products-and-services/business-ruggedized/cf-t8">http://business.panasonic.co.uk/computer-product/products-and-services/business-ruggedized/cf-t8 </a></div>
<div></div>
<div>(Mine is a CF-T8 mk3 model)</div>
<div></div>
<div><span id="more-173"></span></div>
<h1>Installation (base system)</h1>
<div></div>
<div>Download the 64bits iso :</div>
<div></div>
<div><a href="ftp://ftp2.frugalware.org/mirror/ftp.frugalware.org/pub/frugalware//frugalware-1.7-iso/frugalware-1.7-x86_64-cd1.iso">ftp://ftp2.frugalware.org/mirror/ftp.frugalware.org/pub/frugalware//frugalware-1.7-iso/frugalware-1.7-x86_64-cd1.iso</a></div>
<div></div>
<div>Dump the iso to an usb drive (WARNING! WILL ERASE EVERYTHING ON DESTINATION DRIVE!)</div>
<pre># dd if=frugalware*.iso of=/dev/sdX bs=1M</pre>
<div>(replace sdX with your actual drive)</div>
<div></div>
<div>Boot from usb.</div>
<div></div>
<div>Unfortunately the GUI installer will not work, so we select a console installer (the vga fb version works best for me)</div>
<div></div>
<div>I chose the wired network interface (eth0) since the installer seems to only support WEP encryption for the wireless interface.</div>
<div></div>
<h2>Partitioning</h2>
<div></div>
<div>(backup your existing data if needed)</div>
<div></div>
<div>Up to you. I personnally chose to keep a dual boot with the Windows system which was pre-installed on the computer. (If you want to do this too you&#8217;ll have to resize your windows partition beforehand, <a href="http://www.partedmagic.org">PartedMagic</a> and gparted will do the job perfectly).</div>
<div></div>
<div>IMPORTANT NOTE : There is a special trick with the sound card on this model.</div>
<div>See <a href="http://pc-dl.panasonic.co.jp/dl/docs/060222?dc[]=002012&amp;no=5&amp;trn_org=3">http://pc-dl.panasonic.co.jp/dl/docs/060222?dc[]=002012&amp;no=5&amp;trn_org=3</a></div>
<div></div>
<div>Thus I highly suggest keeping your Windows partition (and install the Panasonic &#8220;Hotkey Appendix&#8221; utility if not already present) if you want to be able to unmute the sound.</div>
<div></div>
<div></div>
<div>I created a swap partition so that I can use hibernation (Use at least a partition size equal to the system&#8217;s memory size), and a root partition (No separate /home).</div>
<div></div>
<div></div>
<h2>Package selection</h2>
<div></div>
<div>Do not use &#8220;expert&#8221; mode.</div>
<div>We want a base system only (and we will add the rest later) so uncheck everything except &#8220;base&#8221;.</div>
<div></div>
<h2>Bootloader</h2>
<div></div>
<div>Install GRUB2 on the MBR.</div>
<div></div>
<h2>Users</h2>
<div></div>
<div>Create a regular user.</div>
<div></div>
<div></div>
<div>End of installation, reboot.</div>
<div></div>
<div></div>
<h1>Post-installation configuration</h1>
<div></div>
<div>Upon rebooting, you may notice that the splash screen does not disappear&#8230;(the splash screen can be disabled by removing the &#8220;splash&#8221; option in the bootloader&#8217;s kernel line). Nevermind, just use Ctrl-Alt-F2 to switch to another tty. Login as root.</div>
<div></div>
<div>TIP : if you need to reconfigure network, just run</div>
<pre># netconfig</pre>
<div>then restart the network</div>
<pre># systemctl restart netconfig.service</pre>
<div>(yes, Frugalware uses systemd)</div>
<div></div>
<div>First of all I need to install my favorite text editor, and some useful utilities</div>
<pre># pacman -S nano htop iptables</pre>
<div></div>
<div>(pacman is a merely a symbolic link to /usr/bin/pacman-g2, Frugalware&#8217;s pacman version derived from Arch Linux)</div>
<div></div>
<div>NOTE : when iptables is installed, the firewall is will be started automatically at the next boot.</div>
<div></div>
<h2>Configuring the sound</h2>
<div></div>
<pre># pacman -S alsa-utils
# alsactl init
# alsamixer
(be sure to keep the annoying 'beep' volume low, or even mute!)
# alsactl store
# aplay /usr/share/sounds/alsa/Noise.wav</pre>
<div></div>
<div>Damn, no sound&#8230; Wait, there&#8217;s a workaround (thanks to <a href="http://ubuntuforums.org/showthread.php?t=1138892">http://ubuntuforums.org/showthread.php?t=1138892</a> ) :</div>
<pre># echo &gt;/etc/modprobe.d/alsa-base.conf 'options snd-hda-intel model=thinkpad'</pre>
<div>Reboot again, sound should now be working!</div>
<div></div>
<div>Still no sound? Reboot into your Windows system and make sure the Panasonic &#8220;Hotkey Appendix&#8221; utility is installed.</div>
<div>(Can be downloaded here : <a href="http://pc-dl.panasonic.co.jp/dl/search?q=hotkey+appendix&amp;button=&amp;dc[]=&amp;p1=&amp;p2=&amp;oc=&amp;lang=">http://pc-dl.panasonic.co.jp/dl/search?q=hotkey+appendix&amp;button=&amp;dc[]=&amp;p1=&amp;p2=&amp;oc=&amp;lang=</a> )</div>
<div></div>
<div></div>
<h2>Power Management</h2>
<div></div>
<div>Make sure the laptop mode tools are installed, and some more useful tools as well</div>
<pre># pacman -S laptop-mode-tools cpupower powertop acpi</pre>
<div></div>
<div>Enable laptop mode tools</div>
<pre># systemctl start laptop-mode-tools.service
# systemctl enable laptop-mode-tools.service</pre>
<div></div>
<div>Test laptop mode tools</div>
<pre># laptop_mode</pre>
<div>Should tell &#8220;enabled, not active&#8221;</div>
<div></div>
<div>Unplug power chord</div>
<pre># laptop_mode</pre>
<div>Should tell &#8220;enabled, active&#8221;</div>
<div></div>
<div>While on battery, run at least powertop once to see if everything is OK</div>
<pre># powertop</pre>
<div></div>
<div>I like laptop mode tools to control the LCD brightness</div>
<pre># nano /etc/laptop-mode/conf.d/lcd-brightness.conf</pre>
<div></div>
<div>CONTROL_BRIGHTNESS=1</div>
<div></div>
<div>TODO : some more changes needed for this to work</div>
<div></div>
<div></div>
<div>Use the acpi command to display useful battery info</div>
<pre># acpi</pre>
<div></div>
<div>Test suspend to ram</div>
<pre># pm-suspend</pre>
<div></div>
<div>Test suspend to disk</div>
<pre># pm-hibernate</pre>
<div></div>
<div>Both are working <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div>Test what happens when the lid is closed</div>
<div>(close the lid)</div>
<div>The laptop is not put to sleep, see</div>
<pre># tail /var/log/messages</pre>
<div>&#8220;ACPI action lid is not defined&#8221;</div>
<div></div>
<div>We could change that by editing /etc/apci/acpi_handler.sh</div>
<div></div>
<div>But since I intend to use the XFCE desktop environment, I will define ACPI actions in XFCE&#8217;s power manager.</div>
<div></div>
<div></div>
<div>Hardware sensors</div>
<pre># sensors-detect</pre>
<div></div>
<div></div>
<h2>Installing the XFCE desktop environment</h2>
<div></div>
<pre># pacman -S xfce4 xscreensaver gst-plugins-base-alsa</pre>
<div></div>
<div>This will install xfce and its dependencies (including the X.Org system). The desktop session manager is LightDM.</div>
<div></div>
<div>Before starting xfce, make sure the intel X.Org video driver is installed. We install the synaptics touchpad driver as well.</div>
<pre># pacman -S xf86-video-intel xf86-input-synaptics</pre>
<div></div>
<div>Reboot your system, LightDM should now appear. Log in to XFCE.</div>
<div></div>
<div>TIP : if you don&#8217;t want graphical login by default</div>
<pre># rm /etc/systemd/system/default.target
# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target</pre>
<div></div>
<div>And vice-versa, to enable graphical login again :</div>
<pre># rm /etc/systemd/system/default.target
# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target</pre>
<div></div>
<div></div>
<h3>Wireless network connection management</h3>
<div></div>
<div>(The intel wifi 5100 wireless card is supported out of the box)</div>
<div></div>
<div>I like Wicd</div>
<pre># pacman -S wicd
# systemctl disable netconfig.service
# systemctl enable wicd.service</pre>
<div></div>
<div>Now wicd will also handle wired network connections as well.</div>
<div></div>
<div></div>
<h3>Installing some desktop programs</h3>
<div></div>
<div>Open a terminal, switch to root</div>
<pre>$ su</pre>
<div></div>
<div>Let&#8217;s install some web browsers and email client</div>
<pre># pacman -S chromium-browser firefox thunderbird</pre>
<div></div>
<div>Some multimedia programs (your mileage may vary)</div>
<pre># pacman -S multimedia xmultimedia audacious radiotray</pre>
<div></div>
<div>NOTE : vlc is part of the multimedia package group</div>
<div></div>
<div>TODO : radiotray can&#8217;t replay sound (gst error)</div>
<div></div>
<div></div>
<h3>XFCE session management</h3>
<div></div>
<div>Now, you will notice that when exiting XFCE, you only can disconnect your session. Reboot/Poweroff and sleep modes are grayed out!</div>
<div>This has to do with polkit (PolicyKit) and consolekit.</div>
<div></div>
<div>Install consolekit</div>
<pre># pacman -S consolekit consolekit-x11</pre>
<div>(polkit should be installed already)</div>
<div></div>
<div>Polkit needs to be configured to allow regular users to reboot/shutdown</div>
<pre># cat &gt;/etc/polkit-1/localauthority/50-local.d/40-power.pkla &lt;&lt;EOF
[Local restart]
Identity=unix-group:users
Action=org.freedesktop.consolekit.system.restart
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Local shutdown]
Identity=unix-group:users
Action=org.freedesktop.consolekit.system.stop
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Local restart - multiple]
Identity=unix-group:users
Action=org.freedesktop.consolekit.system.restart-multiple-users
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Local shutdown - multiple]
Identity=unix-group:users
Action=org.freedesktop.consolekit.system.stop-multiple-users
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Local suspend]
Identity=unix-group:users
Action=org.freedesktop.upower.suspend
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Local hibernate]
Identity=unix-group:users
Action=org.freedesktop.upower.hibernate
ResultAny=yes
ResultInactive=no
ResultActive=yes
EOF</pre>
<p>Restart XFCE if needed.</p>
<div></div>
<div></div>
<div>Now you are able to configure XFCE&#8217;s power manager events (Go to Settings&gt;Power Manager)</div>
<div></div>
<div>NOTE : the screen can be automatically locked when suspending/hibernating (XFCE will use xscreensaver. Remember to select a blank screensaver to save battery).</div>
<div></div>
<div></div>
<h3>Laptop special keys</h3>
<div></div>
<div>The screen brightness up/down keys work out of the box (both under X and in console mode)</div>
<div></div>
<div>The volume up/down and mute hotkeys are working (XFCE)</div>
<div></div>
<div>The &#8220;show battery status&#8221;/suspend/hibernate hotkeys work (XFCE).</div>
<div></div>
<div></div>
<h2>Touchscreen</h2>
<div></div>
<div>This laptop is equiped with a Fujitsu USB Touchscreen device. It works out of the box (thanks to X.Org evdev input driver), but it needs to be calibrated.</div>
<div></div>
<div>xinput_calibrator would be the right tool to use, but it isn&#8217;t in frugalware&#8217;s repository, and I wasn&#8217;t able to compile it from the tarball (an error occurs with ./autogen.sh).</div>
<div></div>
<div>So, I compiled it on my main computer running Arch Linux, from the AUR ( <a href="http://aur.archlinux.org/packages.php?ID=35031">http://aur.archlinux.org/packages.php?ID=35031</a> )</div>
<div></div>
<div>Download the executable xinput_calibrator program here : <a href="http://agentoss.files.wordpress.com/2012/09/xinput_calibrator-bin.doc">xinput_calibrator.bin</a> (this is a 64 bit executable!), rename it &#8220;xinput_calibrator&#8221; and copy it to /usr/bin (as root).</div>
<div></div>
<div>We still need to install some dependencies before running it</div>
<pre># pacman -S gtkmm2</pre>
<div></div>
<div>then run (as a regular user)</div>
<pre>$ xinput_calibrator</pre>
<div></div>
<div>Then create (as root) the /etc/X11/xorg.conf.d/99-calibration.conf file with the output content. Restart X. Touchscreen calibrated!</div>
<div></div>
<div></div>
<div></div>
<div>
<div>TODO : reboot/shutdown in lightdm</div>
<div>TODO : fstab optimization (/tmp in tmpfs, noatime&#8230;)</div>
</div>
<div></div>
<div></div>
<h1>References</h1>
<div></div>
<div><a href="http://frugalware.org/docs/stable/index">http://frugalware.org/docs/stable/index</a></div>
<div><a href="https://wiki.frugalware.org/">https://wiki.frugalware.org/</a></div>
<div><a href="http://fedoraproject.org/wiki/Systemd">http://fedoraproject.org/wiki/Systemd</a></div>
<div><a href="http://pc-dl.panasonic.co.jp/dl/docs/060222?dc[]=002012&amp;no=5&amp;trn_org=3 (sound card bug)">http://pc-dl.panasonic.co.jp/dl/docs/060222?dc[]=002012&amp;no=5&amp;trn_org=3</a> (sound card bug)</div>
<div><a href="http://ubuntuforums.org/showthread.php?t=1138892 (sound card workaround)">http://ubuntuforums.org/showthread.php?t=1138892</a> (sound card workaround)</div>
<div><a href="http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt">http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt</a></div>
<div><a href="http://wiki.gentoo.org/wiki/Xfce#Enabling_power_off_and_restart_buttons_from_exit_window">http://wiki.gentoo.org/wiki/Xfce#Enabling_power_off_and_restart_buttons_from_exit_window</a></div>
<div><a href="http://www.freedesktop.org/wiki/Software/xinput_calibrator">http://www.freedesktop.org/wiki/Software/xinput_calibrator</a></div>
<div></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=173&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/09/07/frugalware-linux-1-7-on-panasonic-toughbook-cf-t8-laptop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2012/09/frugalwarelogo.png" medium="image">
			<media:title type="html">frugalwarelogo</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2012/09/toughbook-t8-9-500x500.jpg?w=300" medium="image">
			<media:title type="html">toughbook-t8-9-500x500</media:title>
		</media:content>
	</item>
		<item>
		<title>Mageia 2 LAMP server</title>
		<link>http://agentoss.wordpress.com/2012/08/11/mageia-2-lamp-server/</link>
		<comments>http://agentoss.wordpress.com/2012/08/11/mageia-2-lamp-server/#comments</comments>
		<pubDate>Sat, 11 Aug 2012 11:03:10 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mageia]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mageia]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=154</guid>
		<description><![CDATA[Mageia can also be used to setup fast, clean and easy to use server systems. Installation from the Wired Network-based install CD http://www.mageia.org/en/downloads/ Minimal installation Boot from the iso. Just follow the installation procedure : Installation method : FTP or HTTP server Medium : Mageia 2 Select your preferred mirror carefully. Partitioning Since this is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=154&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1><a href="http://www.mageia.org"><img class="aligncenter size-medium wp-image-159" title="mageia-2011" src="http://agentoss.files.wordpress.com/2012/08/mageia-2011.png?w=300&#038;h=134" alt="" width="300" height="134" /></a></h1>
<h1><span class="Apple-style-span" style="font-weight:normal;font-size:medium;"><a href="http://www.mageia.org/">Mageia</a> can also be used to setup fast, clean and easy to use server systems.</span></h1>
<div></div>
<div></div>
<div>Installation from the <strong>Wired Network-based install CD</strong></div>
<div></div>
<div><a href="http://www.mageia.org/en/downloads/">http://www.mageia.org/en/downloads/</a></div>
<div></div>
<div></div>
<div><span id="more-154"></span></div>
<h2>Minimal installation</h2>
<div></div>
<div>Boot from the iso.</div>
<div></div>
<div>Just follow the installation procedure :</div>
<div></div>
<div>Installation method : FTP or HTTP server</div>
<div>Medium : Mageia 2</div>
<div></div>
<div>Select your preferred mirror carefully.</div>
<div></div>
<h3>Partitioning</h3>
<div></div>
<div>Since this is a web server, I personally like to create a separate /var partition.</div>
<div></div>
<h3>Select packages</h3>
<div></div>
<div>We are doing a minimal install, so deselect everything!</div>
<div>(we could directly choose web/ftp/database/etc servers but I like to do it by hand)</div>
<div></div>
<div>When everything is deselected, a following screen will offer you some more choices. Just accept the defaults.</div>
<div></div>
<h3>Users</h3>
<div></div>
<div>Set a root password, and create a regular user.</div>
<div></div>
<div>Installation terminated, reboot.</div>
<div></div>
<div></div>
<h2>Configuration</h2>
<div></div>
<div>Login as root</div>
<div></div>
<div># df -h</div>
<div>Shows that a minimal install takes less than 600M of disk space, that&#8217;s nice!</div>
<div></div>
<div>Update packages database</div>
<div># urpmi.update -a</div>
<div></div>
<div>Install server-flavored kernel and some useful programs while we are at it</div>
<div># urpmi kernel-server-latest nano mlocate htop</div>
<div></div>
<div>Set the hostname</div>
<div># echo &gt;/etc/hostname mageiabox.example.com</div>
<div># nano /etc/hosts</div>
<div>(edit accordingly)</div>
<div></div>
<div>Then reboot!</div>
<div></div>
<h3>IMPORTANT!</h3>
<div>By default, the firewall (shorewall) is enabled (unless you disabled it at installation time), and does not allow incoming connections.</div>
<div></div>
<div></div>
<div>Install some useful servers : ntpd, sshd</div>
<div># urpmi ntpd sshd</div>
<div></div>
<div>Note : by default, ssh root login is not permitted.</div>
<div></div>
<div>Install and configure Postfix mail server (here just to be able to send mails</div>
<div>see  <a href="http://www.postfix.org/STANDARD_CONFIGURATION_README.html#stand_alone">http://www.postfix.org/STANDARD_CONFIGURATION_README.html#stand_alone</a></div>
<div># urpmi postfix nail</div>
<div>(the nail package contains the regular mail/mailx command line program)</div>
<div></div>
<div>Edit postfix&#8217;s main configuration</div>
<div># nano /etc/postfix/main.cf</div>
<div></div>
<div>(I personally add my ISP&#8217;s relayhost)</div>
<div>relayhost = smtp.myisp.com</div>
<div></div>
<div>Edit aliases if needed</div>
<div># nano /etc/postfix/aliases</div>
<div></div>
<div>I personally set a root: alias with another email address.</div>
<div>root: me@myaddress.com</div>
<div></div>
<div>Don&#8217;t forget</div>
<div># newaliases</div>
<div></div>
<div>Then start postfix</div>
<div># service postfix start</div>
<div></div>
<div>Send a test mail</div>
<div># echo &#8220;From my Mageia server!&#8221; | mail -s &#8220;Hello&#8221; me@myaddress.com</div>
<div></div>
<div>In case of problems, check the logs</div>
<div># tail /var/log/mail/info.log</div>
<div></div>
<div>Now install the LAMP (Apache-Mysql-Php) stack</div>
<div>There are several variants, check with</div>
<div># urpmq -S -a lamp</div>
<div>And install</div>
<div># urpmi task-lamp</div>
<div></div>
<div>Note: this task will also install proftpd FTP server.</div>
<div>To disable proftpd :</div>
<div># chkconfig proftpd off &amp;&amp; service proftpd stop</div>
<div></div>
<div>Next, we must start and set a root password to MariaDB (mysql drop-in replacement in Mageia)</div>
<div># service mysqld start</div>
<div># mysqladmin password</div>
<div>(set new root password)</div>
<div></div>
<div>If you need to review the specific instructions for this MariaDB package</div>
<div># more /usr/share/doc/mariadb/README.urpmi</div>
<div></div>
<div>Note : this LAMP stack also comes with phpmyadmin and php-eaccelerator.</div>
<div></div>
<h3>Apache</h3>
<div></div>
<div>Under Mageia, Apache&#8217;s process is httpd, process user and group are both &#8220;apache&#8221;. Configuration files are located in /etc/httpd/</div>
<div></div>
<div>Start Apache</div>
<div># service httpd start</div>
<div></div>
<div>We need to configure the firewall to allow access to our web server from the outside.</div>
<div>Very simple with</div>
<div># drakfirewall</div>
<div></div>
<div>(we could also edit manually the /etc/shorewall/rules file, and restart shorewall)</div>
<div></div>
<div>Your web server is now accessible from the other hosts.</div>
<div></div>
<div>Web statistics with Awstats</div>
<div># urpmi awstats</div>
<div>There is a daily cron job, but it is possible to generate stats asap</div>
<div># /usr/share/awstats/www/awstats.pl -config=awstats.conf -update</div>
<div>Can be consulted at <a href="http://&lt;yourserver&gt;/awstats" rel="nofollow">http://&lt;yourserver&gt;/awstats</a></div>
<div></div>
<div></div>
<h3>Need a blog? Easy installation of WordPress</h3>
<div># urpmi wordpress</div>
<div>Create a database</div>
<pre># mysql -uroot -p &lt;&lt;EOF
CREATE DATABASE mywpdatabase;
GRANT ALL PRIVILEGES ON mywpdatabase.* TO "mywpuser"@"localhost" IDENTIFIED BY "mywppassword";
FLUSH PRIVILEGES;
EXIT
EOF</pre>
<div></div>
<div>Point your browser to http:&lt;yourserver&gt;/wordpress to finish installation.</div>
<div></div>
<h3>Need a CMS?</h3>
<div>Drupal is available in the repository.</div>
<div># urpmi drupal</div>
<div></div>
<h3>Need a wiki?</h3>
<div># urpmq -a -S wiki</div>
<div></div>
<div>There&#8217;s Dokuwiki (lightweight), Mediawiki (heavyweight).</div>
<div></div>
<div>Example for Mediawiki, without suggested packages</div>
<div># urpmi &#8211;no-suggests mediawiki</div>
<div>or the much lighter version</div>
<div># urpmi &#8211;no-suggests mediawiki-minimal</div>
<div></div>
<div>Now initialize your new wiki &#8220;mywiki&#8221;</div>
<div># mediawiki-create /var/www/mediawiki/mywiki</div>
<div></div>
<div>And enable it within Apache</div>
<div># nano /etc/httpd/conf/webapps.d/mediawiki.conf</div>
<div></div>
<pre>Alias /skins /usr/share/mediawiki/skins
Alias /wiki /var/www/mediawiki/mywiki
&lt;Directory "/var/www/mediawiki/mywiki"&gt;
   Order allow,deny
   Allow from All
   Options +FollowSymLinks
&lt;/Directory&gt;</pre>
<div></div>
<div># apachectl restart</div>
<div></div>
<div>Create missing &#8220;skins&#8221; symlink</div>
<div># ln -s /usr/share/mediawiki/skins /var/www/mediawiki/mywiki/skins</div>
<div></div>
<div>Point your browser to <a href="http://&lt;yourserver&gt;/wiki" rel="nofollow">http://&lt;yourserver&gt;/wiki</a> and follow the install process.</div>
<div></div>
<div><span class="Apple-style-span" style="font-size:16px;font-weight:bold;"> </span></div>
<div><span class="Apple-style-span" style="font-size:16px;font-weight:bold;">Need OwnCloud?</span></div>
<div># urpmi owncloud</div>
<div>Then point your browser to <a href="http://&lt;yourserver&gt;/owncloud/" rel="nofollow">http://&lt;yourserver&gt;/owncloud/</a></div>
<div></div>
<div>Note : this may not be the latest version.</div>
<div></div>
<h3>Need a web-based project management system?</h3>
<div>Chiliproject, Redmine are packaged.</div>
<div></div>
<h3>Need a bug-tracking web-based system?</h3>
<div>Bugzilla is in the repository.</div>
<div># urpmi &#8211;no-suggests bugzilla</div>
<div></div>
<div></div>
<h3>Need a Pastebin?</h3>
<div>Stikked is here.</div>
<div># urpmi stikked</div>
<div>Read the install docs</div>
<div># more /usr/share/stikked/INSTALL</div>
<div></div>
<div></div>
<div>At the time of writing this, there are only few webapps in the repositories (and versions maybe slightly lagging behind). But nothing prevents you from installing your favorite webapp from the project&#8217; source.</div>
<div></div>
<h2>Basic server supervision</h2>
<div></div>
<h3>smartmontools and hddtemp for hard disk health monitoring</h3>
<div># urpmi smartmontools hddtemp</div>
<div>eventually review smartd daemon configuration</div>
<div># nano /etc/smartd.conf</div>
<div>start daemon</div>
<div># chkconfig smartd on; service smartd start</div>
<div></div>
<div>Display status for /dev/sda</div>
<div># smartctl -H /dev/sda</div>
<div></div>
<h3>Sensors (can be used with Munin for monitoring temperatures, fan speeds, etc)</h3>
<div># urpmi lm_sensors</div>
<div>Then run</div>
<div># sensors-detect</div>
<div></div>
<h3>Logwatch (daily cron job)</h3>
<div># urpmi logwatch</div>
<div>Review config file</div>
<div># nano /etc/log.d/logwatch.conf</div>
<div></div>
<div></div>
<div></div>
<h3>Graphical supervision with munin 2.0</h3>
<div># urpmi munin-master munin-node</div>
<div></div>
<div>You may receive email warnings about missing munin-conf.d directory, so we create it:</div>
<div># mkdir -p /etc/munin/munin-conf.d</div>
<div></div>
<div>Add some more plugins (sensors&#8230;)</div>
<div># ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/</div>
<div></div>
<div>Don&#8217;t forget to restart node</div>
<div># service munin-node restart</div>
<div></div>
<div>Please allow several minutes for Munin to generate his first html data (in case you&#8217;re encountering an &#8220;access denied&#8221; error when accessing the URL), then access your Munin dashboard by pointing your browser to <a href="http://&lt;yourserver&gt;/munin" rel="nofollow">http://&lt;yourserver&gt;/munin</a></div>
<div></div>
<h2>Basic server security</h2>
<div>(Please note, web server hardening is not the goal of this howto!)</div>
<h3>Install Mageia-specific security tools, such as msec</h3>
<div># urpmi &#8211;no-suggests msec</div>
<div>Show current msec policy</div>
<div># msec</div>
<div></div>
<div>Your system will be checked periodically via cron jobs (in /etc/cron.*/msec)</div>
<div></div>
<div>Check the logs</div>
<div># less /var/log/msec.log</div>
<div></div>
<div></div>
<h3>rkhunter (rootkit detection)</h3>
<div># urpmi rkhunter</div>
<div># rkhunter &#8211;propupd</div>
<div># rkhunter &#8211;check</div>
<div>(you may encounter some false positives)</div>
<div>A daily cron job is created.</div>
<div></div>
<h3>Fail2ban (anti brute-force)</h3>
<div># urpmi fail2ban</div>
<div>Edit configuration (you should enable at least the ssh-iptables jail, and correct the email addresses in sendmail-whois)</div>
<div># nano /etc/fail2ban/jail.conf</div>
<div>And start daemon</div>
<div># service fail2ban start</div>
<div></div>
<div>Test brute force ssh with this command from another machine :</div>
<div>$ ssh invaliduser@&lt;yourserver&gt;</div>
<div>(try any password many times)</div>
<div></div>
<div>Now you can see the result on the server with the command</div>
<div># fail2ban-client status ssh-iptables</div>
<div>And you&#8217;ll see the banned IP from the &#8220;attacking&#8221; machine <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<div></div>
<div></div>
<h2>TIPS</h2>
<div></div>
<div>Always read the man pages and the docs!</div>
<div># ls -al /usr/share/doc/</div>
<div></div>
<div>Show all available packages</div>
<div># urpmq &#8211;list -f |less</div>
<div>(or better, use the AppDb website, link below)</div>
<div></div>
<div>Show info for a package</div>
<div># urpmq -Si &lt;package&gt;</div>
<div></div>
<div>Update system</div>
<div># urpmi &#8211;auto-update</div>
<div></div>
<div>Show currently active repositories</div>
<div># urpmq &#8211;list-media active</div>
<div></div>
<div></div>
<h2>Useful links</h2>
<div>Official documentation</div>
<div><a href="https://doc.mageia.org/">https://doc.mageia.org/</a></div>
<div></div>
<div><a href="https://wiki.mageia.org/en/URPMI">https://wiki.mageia.org/en/URPMI</a></div>
<div></div>
<div>Mageia AppDb</div>
<div><a href="http://mageia.madb.org/">http://mageia.madb.org/</a></div>
<div></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=154&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/08/11/mageia-2-lamp-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2012/08/mageia-2011.png?w=300" medium="image">
			<media:title type="html">mageia-2011</media:title>
		</media:content>
	</item>
		<item>
		<title>Building a simple lightweight web kiosk system with Arch GNU/Linux</title>
		<link>http://agentoss.wordpress.com/2012/07/31/building-a-simple-lightweight-web-kiosk-system-with-arch-gnulinux/</link>
		<comments>http://agentoss.wordpress.com/2012/07/31/building-a-simple-lightweight-web-kiosk-system-with-arch-gnulinux/#comments</comments>
		<pubDate>Tue, 31 Jul 2012 10:36:09 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Arch]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[fast boot]]></category>
		<category><![CDATA[lightweight]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[web kiosk]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=149</guid>
		<description><![CDATA[Optimized for maximum boot speed and read-only filesystem operation (especially for usb drives and other flash memory cards). DISCLAIMER : As always, use this tutorial at your own risk! Hardware used for this howto : Mini-ITX motherboard with Pentium-M 1.5GHz (centrino) 512M DDR ram Integrated graphics, sound and ethernet. 8G Compact Flash card with IDE-CF [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=149&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Optimized for maximum boot speed and read-only filesystem operation (especially for usb drives and other flash memory cards).</p>
<h1>DISCLAIMER : As always, use this tutorial at your own risk!</h1>
<p>Hardware used for this howto :<br />
Mini-ITX motherboard with Pentium-M 1.5GHz (centrino)<br />
512M DDR ram<br />
Integrated graphics, sound and ethernet.<br />
8G Compact Flash card with IDE-CF adapter.</p>
<p><span id="more-149"></span></p>
<h2>Installation</h2>
<p>Go and download the official netinstall iso image at <a href="https://www.archlinux.org/download/">https://www.archlinux.org/download/</a><br />
As root, copy the iso to an empty USB drive (it even fits on an old 512M drive)</p>
<p># dd if=archlinux*netinstall*.iso of=/dev/sdX bs=1M<br />
# sync</p>
<p>Usual warning, replace /dev/sdX with your actual drive, ALL DATA WILL BE ERASED on the drive!<br />
Now boot the system with the usb drive (32 or 64 bits, the choice is yours).<br />
When booted, you are presented with a short message and a root prompt, let&#8217;s begin installation.<br />
Setup your keymap for a more comfortable usage (here for french keymap)</p>
<p># loadkeys fr</p>
<p>If you need to see the short installation message again</p>
<p># more /etc/motd</p>
<p>Fire up (wired) networking (here for a dhcp client on eth0)</p>
<p># dhcpcd eth0</p>
<p>If you don&#8217;t have a dhcp server, setup the interface manually with ifconfig and write your DNS servers in /etc/resolv.conf</p>
<p># ifconfig eth0 &lt;ipaddr&gt; &lt;netmask&gt;</p>
<p>Now it&#8217;s even better if you can log on the system via SSH and copy/paste the rest of the commands from this howto!<br />
Set up a password for root (ssh logins are not possible without password by default)</p>
<p># passwd</p>
<p>Startup SSH daemon</p>
<p># rc.d start sshd</p>
<p>And you should be able to connect remotely on this machine from another.<br />
TIP : to see your ip address</p>
<p># ip addr show eth0</p>
<p>Partition your target installation media (here it&#8217;s /dev/sda for me).<br />
Just for the sake of changing a bit we will use cfdisk instead of fdisk.</p>
<p># cfdisk /dev/sda</p>
<p>Create 2 partitions :<br />
/dev/sda1 : for the system (bootable)<br />
/dev/sda2 : swap partition (should be at least the size of the system&#8217;s RAM)<br />
Format the filesystem (here for a read-only system, we will be using ext4 without the journal feature)</p>
<p># mkfs.ext4 /dev/sda1 -O ^has_journal<br />
# mkswap /dev/sda2</p>
<p>Mount the target root filesystem</p>
<p># mount /dev/sda1 /mnt</p>
<p>Start the Arch base system bootstrap</p>
<p># pacstrap /mnt base</p>
<p>The base system packages are being downloaded and installed.<br />
Now let&#8217;s chroot into our target system</p>
<p># arch-chroot /mnt</p>
<p>Before rebooting the system, a proper bootloader is necessary. I personnally like a faster and simpler bootloader (good bye GRUB2!) but your mileage may vary.<br />
Note : as of 2012/07/20 Grub Legacy is not officially supported anymore by Arch, see <a href="http://www.archlinux.org/news/grub-legacy-no-longer-supported/" rel="nofollow">http://www.archlinux.org/news/grub-legacy-no-longer-supported/</a><br />
So let&#8217;s use the good old LILO</p>
<p># pacman -S lilo</p>
<p>Review and edit lilo.conf</p>
<p># nano /etc/lilo.conf</p>
<blockquote><p>#<br />
# /etc/lilo.conf<br />
#<br />
boot=/dev/sda<br />
# This line often fixes L40 errors on bootup<br />
# disk=/dev/hda bios=0&#215;80<br />
default=arch<br />
timeout=50<br />
lba32<br />
prompt<br />
image=/boot/vmlinuz-linux<br />
label=arch<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux.img<br />
read-only</p></blockquote>
<p>Then write up the bootloader</p>
<p># lilo -v</p>
<p>Now you can reboot your system!</p>
<h2>Post-installation configuration</h2>
<p>Login as root (empty password)</p>
<p># loadkeys fr</p>
<p>The / filesystem may be mounted read-only already. In order to make changes we are remounting it writable.</p>
<p># mount -o remount,rw /</p>
<p>Edit /etc/fstab for the change to be permanent</p>
<p># nano /etc/fstab</p>
<p>Add the line :</p>
<p>/dev/sda1/ext4defaults,noatime,rw01<br />
Set a new root password</p>
<p># passwd</p>
<p>As usual with Arch, we begin with the configuration of /etc/rc.conf</p>
<p># man rc.conf<br />
# nano /etc/rc.conf</p>
<p>Setup your network settings, I use dhcp so leave untouched the network section.<br />
Setup your hostname</p>
<p># echo &gt;/etc/hostname archweb</p>
<p>Timezone</p>
<p># ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime</p>
<p>Uncomment preferred locale in /etc/locale.gen, and generate it</p>
<p># nano /etc/locale.gen &amp;&amp; locale-gen</p>
<p>Set locale</p>
<p># echo &gt;/etc/locale.conf &#8216;LANG=fr_FR.UTF-8&#8242;</p>
<p>Keymap</p>
<p># echo &gt;/etc/vconsole.conf &#8216;KEYMAP=fr&#8217;<br />
(Reboot system to ensure everything works well)<br />
Install and start sshd so that you can remotely connect on this machine</p>
<p># pacman -S openssh &amp;&amp; rc.d start sshd</p>
<p>Create a regular user &#8220;guest&#8221;</p>
<p># adduser guest</p>
<p>additional groups : video,audio<br />
(or else your user will not have sound playback or access to webcam)<br />
Also set a password for this user.</p>
<p>Sound configuration</p>
<p># pacman -S alsa-utils &amp;&amp; alsactl init<br />
# alsamixer; alsactl store<br />
# aplay /usr/share/sounds/alsa/Noise.wav</p>
<p>add then alsa daemon to rc.conf</p>
<p># nano /etc/rc.conf</p>
<p>Install some more useful system packages</p>
<p># pacman -S net-tools htop lzop</p>
<p>(lzop needed for tar &#8211;lzop)<br />
Minimal X.Org installation</p>
<p># pacman -S xorg-server xorg-xinit xorg-setxkbmap xorg-xmessage xf86-input-evdev xf86-video-vesa xf86-video-fbdev rxvt-unicode feh</p>
<p>(some more dependencies will of course be automatically installed)<br />
If you now the right xf86-video-* driver for your graphics card, add it to the line. For my test system with Intel integrated graphics, I used xf86-video-intel.<br />
ATI users will add xf86-video-ati, nVidia users will add xf86-video-nv OR xf86-video-nouveau.<br />
When the target system is a removable media (usb pendrive), it&#8217;s a good idea to install them all.<br />
Use urxvt terminal emulator instead of xterm</p>
<p># ln -s /usr/bin/urxvt /usr/bin/xterm</p>
<p>Installing a lightweight window manager<br />
For this howto I chose to use the lwm window manager. It&#8217;s ultra-lightweight, mouse-driven, requires no configuration and has no hotkey shortcuts.</p>
<p># pacman -S lwm</p>
<p>If you prefer another, super lightweight, non-tiling wm, I suggest fluxbox (configuration is a bit easier than openbox).<br />
ratpoison also come to mind, but it&#8217;s more keyboard-oriented.<br />
spectrwm makes a good choice for a minimalist tiling wm (and doesn&#8217;t require compilation unlike dwm).</p>
<p>Login as regular user &#8220;guest&#8221;</p>
<p>$ cat &gt;~/.xinitrc &lt;&lt;EOF<br />
setxkbmap fr &amp;<br />
urxvt &amp;<br />
exec lwm<br />
EOF</p>
<p>and start X</p>
<p>$ startx<br />
Right now the whole system uses approx. ~800M of disk space.</p>
<p>Installing and configuring the web browsers<br />
It may be interesting to install several web browsers (Firefox, Chromium, Opera, and Surf) and let the user chose which one he wants to use (see that later)<br />
Note : Surf ( <a href="http://suckless.org/" rel="nofollow">http://suckless.org/</a> ) is a minimalist, fast non-tabbed webkit-based browser.<br />
From now on I&#8217;ll focus mainly on Firefox as it is still my favourite browser (although Chromium and Opera show quite faster startup times)</p>
<p># pacman -S chromium opera gstreamer0.10-base-plugins gstreamer0.10-good surf firefox arch-firefox-search firefox-adblock-plus firefox-noscript</p>
<p>TIP : install only Opera if short on disk space (will use ~100M of disk)<br />
Install some nicer fonts as well</p>
<p># pacman -S ttf-liberation ttf-ubuntu-font-family ttf-droid</p>
<p>Then configure the fonts in Firefox accordingly (Edit&gt;Preferences&gt;Content&gt;Advanced)<br />
(also pick a nice theme/persona for your Firefox while you&#8217;re at it, since the default GTK theme looks quite bland!)<br />
You may want to install the dreaded flash and java plugins, and a small pdf viewer</p>
<p># pacman -S flashplugin jre7-openjdk icedtea-web-java7 epdfview</p>
<p>TIP : avoid java if short on disk space.<br />
TODO : chromium config<br />
TODO : opera config</p>
<p>Automatically start the web browser with X (and with a custom start page)<br />
Here we make sure that the browser is restarted automatically when the user closes it.<br />
Also, which web browser to start is determined by the kernel command line (and thus by the boot menu <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )<br />
We are also setting a background wallpaper using feh. Download a nice wallpaper from interfacelift.com (for instance) and save it to /usr/share/wallpaper/wallpaper.jpg<br />
(or use the official Arch wallpaper package -around ~10M- : archlinux-wallpaper)<br />
Note : this is the system-wide xinitrc</p>
<p># nano /etc/X11/xinit/xinitrc</p>
<p>Delete the lines below (and including) the &#8220;twm &amp;&#8221;, and append the following lines :</p>
<blockquote><p># xinitrc<br />
#<br />
# default url to start browser to<br />
URL=&#8221;file:///usr/local/share/doc/homepage/index.html&#8221;<br />
# for debugging purposes<br />
#URL=&#8221;file:///tmp/debug.html&#8221;<br />
# set wallpaper<br />
feh &#8211;bg-scale &#8211;no-fehbg /usr/share/wallpaper/wallpaper.jpg<br />
# set keymap, eventually start some program and of course our window manager<br />
setxkbmap fr &amp;<br />
#urxvt &amp;<br />
lwm &amp;<br />
# parse browser= parameter from kernel command line<br />
# to determine with web browser to use (if parameter not found, a default browser is used)<br />
CMDLINE=`cat /proc/cmdline`<br />
WEB_BROWSER=&#8221;firefox&#8221;<br />
for x in $CMDLINE; do<br />
[[ $x = browser=* ]] || continue<br />
WEB_BROWSER=`printf &#8216;%b\n&#8217; &#8220;${x#browser=}&#8221;`<br />
done<br />
# for debugging purposes<br />
#echo &gt;/tmp/debug.html &#8220;System startup time (s) (before starting browser): `cat /proc/uptime`&#8221;<br />
# start browser, infinite loop<br />
# if the browser cannot be started, display an error message<br />
while true;<br />
do<br />
$WEB_BROWSER $URL || xmessage -center -buttons &#8220;Ooops!&#8221; &#8220;For some reason, the web browser &#8216;$WEB_BROWSER&#8217; could not start!&#8221;<br />
sleep 1<br />
done<br />
# this is never executed<br />
exit 0</p></blockquote>
<p>Automatically login (as regular user &#8220;guest&#8221;) into X at boot time</p>
<p># nano /etc/rc.local</p>
<blockquote><p>su &#8211; guest -c startx &amp;<br />
exit 0</p></blockquote>
<p>(make sure /usr/bin/Xorg has the setuid bit set, this is normally the default in Arch)</p>
<p># chmod u+s /usr/bin/Xorg</p>
<p>Now reboot your system and see.</p>
<p>Optimizations<br />
It is possible to gain a great amount of boot time by using several techniques.<br />
Recompress the initramfs with LZO (fastest decompression)</p>
<p># /etc/mkinitcpio.conf</p>
<blockquote><p>COMPRESSION=&#8221;lzop&#8221;</p></blockquote>
<p>and rebuild</p>
<p># mkinitcpio -p linux<br />
Start daemons in background in /etc/rc.conf</p>
<p># nano /etc/rc.conf</p>
<blockquote><p>DAEMONS=(syslog-ng @network @crond @dbus @alsa @sshd)</p></blockquote>
<p>(You may experience that the browser is unable to connect to the network for several seconds right after booting, that&#8217;s because network initialization hasn&#8217;t yet completed, especially when using dhcp. Just wait some more seconds and refresh the page)<br />
Might be better to use a fixed non-dhcp network configuration. Or you can use an offline default start page (~/index.html).<br />
Use some kernel boot-time options in the bootloader&#8217;s configuration (here for lilo) : quiet and fastboot.<br />
Also use a trick to hide the console messages during boot, by redirecting output to the serial console (console=ttyS0).<br />
And change lilo&#8217;s default menu colors with a slightly less ugly, Arch-inspired scheme, while we&#8217;re at it!<br />
You have to create a nice 640x480x256 colors bmp image or use a lilo provided one.</p>
<p># nano /etc/lilo.conf</p>
<p>#<br />
# /etc/lilo.conf<br />
#<br />
boot=/dev/sda<br />
default=Firefox<br />
timeout=50<br />
lba32<br />
prompt<br />
compact<br />
# set console vga mode to 1024x768x16 when booting<br />
vga=0&#215;317<br />
#install=menu<br />
#menu-title = &#8220;Arch Linux Lightweight Web Kiosk&#8221;<br />
#menu-scheme = Bk:Ck<br />
install=bmp<br />
# path to your custom bitmap image<br />
#bitmap=/boot/archlinux-boot.bmp<br />
# or else use an image provided with lilo<br />
bitmap=/boot/inside.bmp<br />
# position of menu entries<br />
#bmp-table=300p,200p,1,15,17<br />
# hide menu timer (but timeout still active)<br />
#bmp-timer=none<br />
image=/boot/vmlinuz-linux<br />
label=Firefox<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux.img<br />
read-only<br />
# the &#8220;browser=&#8221; parameter determines which web browser will be started<br />
append=&#8221;quiet fastboot console=ttyS0 browser=firefox&#8221;</p>
<p>image=/boot/vmlinuz-linux<br />
label=Chromium<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux.img<br />
read-only<br />
append=&#8221;quiet fastboot console=ttyS0 browser=chromium&#8221;<br />
image=/boot/vmlinuz-linux<br />
label=Opera<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux.img<br />
read-only<br />
append=&#8221;quiet fastboot console=ttyS0 browser=opera&#8221;<br />
image=/boot/vmlinuz-linux<br />
label=Surf<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux.img<br />
read-only<br />
append=&#8221;quiet fastboot console=ttyS0 browser=surf&#8221;<br />
# Maintenance mode : boot in single mode &#8220;S&#8221; with the fallback initramfs<br />
image=/boot/vmlinuz-linux<br />
label=&#8221;MaintenanceMode&#8221;<br />
root=/dev/sda1<br />
initrd=/boot/initramfs-linux-fallback.img<br />
read-only<br />
append=&#8221;S&#8221;</p>
<p>Don&#8217;t forget to update lilo</p>
<p># lilo -v<br />
Using disks UUIDs<br />
If you have installed this system on a removable drive, you&#8217;ll WANT to use UUIDs. Fortunately, LILO understands this well.<br />
First generate the UUIDs for your partitions</p>
<p># blkid</p>
<p>Then update /etc/fstab accordingly (replace /dev/sda1 with UUID=&#8221;copy_and_paste_uuid_from_blkid_s_output&#8221;)</p>
<blockquote><p>UUID=&#8221;796e578f-0b2e-4994-8f2b-84fbd9f60c66&#8243; /   ext4    defaults,noatime,ro     0       1</p></blockquote>
<p>(do the same for other disk partitions when needed)<br />
Then update lilo.conf</p>
<p># lilo-uuid-diskid</p>
<p>This will change the &#8220;boot=&#8221; option in lilo.conf with the disk&#8217;s id.<br />
But you may also need to manually replace the &#8220;root=&#8221; value for every kernel entry.<br />
This would give (excerpt) :</p>
<blockquote><p>image=/boot/vmlinuz-linux<br />
label=Firefox<br />
#        root=/dev/sda1<br />
root=&#8221;UUID=796e578f-0b2e-4994-8f2b-84fbd9f60c66&#8243;</p></blockquote>
<p>When done, update lilo</p>
<p># lilo -v</p>
<p>Trimming down the system a bit<br />
At this stage, our system has grown up to ~1.5G of disk space, which is a quite lot already.<br />
Let&#8217;s try to save some megs here and there.<br />
Show installed packages</p>
<p># pacman -Q |more</p>
<p>Remove core manpages? You decide!</p>
<p># pacman -Qi man-pages</p>
<p>takes ~15M of disk space</p>
<p># pacman -R manpages</p>
<p>NOTE : this will not erase the man pages from non-core programs, so we do it</p>
<p># rm -rvf /usr/share/man/*</p>
<p>Erase the documentation, the include and source files as well (*except* if you plan to compile things!)</p>
<p># rm -rvf /usr/share/{doc,gtk-doc}/*<br />
# rm -rvf /usr/{include,src}/*</p>
<p>Remove useless locale files (/usr/share/locale/) *except* some</p>
<p># shopt -s extglob<br />
# rm -rvf /usr/share/locale/!(fr|en_US|locale.alias)</p>
<p>(here we only keep fr and en_US locales, the rest is deleted!)<br />
(Too bad Arch doesn&#8217;t have an official equivalent to Debian&#8217;s localepurge)<br />
NOTE : don&#8217;t forget to do this again whenever you add some packages or update the system<br />
See disk usage per directory and hunt down some more useless stuff (for our usage anyway!) at your convenience</p>
<p># du -m -d 1 / |sort -g<br />
# du -m -d 1 /usr |sort -g<br />
Some other packages not needed for our setup (won&#8217;t save many megs&#8230;)</p>
<p># pacman -R lvm2 mdadm xfsprogs reiserfsprogs ppp</p>
<p>And finally clean pacman&#8217;s downloaded packages (should gain at least ~200M!)</p>
<p># pacman -S &#8211;clean &#8211;clean</p>
<p>(yes, &#8211;clean two times to force full removal of cached packages)</p>
<p>Reduce the number of ttys<br />
This will save some precious RAM on low-memory systems.</p>
<p># nano /etc/inittab</p>
<p>Comment out some ttys (leave at least the first one!)</p>
<p>Prelink binaries for faster program startup (Optional)</p>
<p># pacman -S prelink<br />
# prelink -a<br />
Security</p>
<p>Remove terminal emulators<br />
(so that users can&#8217;t execute a terminal using the various window manager&#8217;s hotkeys, and thus can&#8217;t kill the window manager)</p>
<p># pacman -R rxvt-unicode</p>
<p>(Note : You&#8217;ll still be able to access the system via SSH if needed)<br />
Forbid user from exiting the window manager.<br />
lwm does not have a hotkey to quit, so it&#8217;s all good. For another wm it will be necessary to disable the corresponding hotkey shortcut or menu entry.<br />
Disable Kernel SysRq keys ( <a href="https://wiki.archlinux.org/index.php/Keyboard_Shortcuts" rel="nofollow">https://wiki.archlinux.org/index.php/Keyboard_Shortcuts</a> )</p>
<p># nano /etc/sysctl.conf</p>
<p>Make sure the kernel.sysrq value is set to 0 (this is normally the default in Arch Linux).<br />
Disable tty switching in X (See man xorg.conf for reference)</p>
<p># cat &gt;/etc/X11/xorg.conf.d/10-custom.conf &lt;&lt;EOF<br />
Section &#8220;ServerFlags&#8221;<br />
Option &#8220;DontVTSwitch&#8221; &#8220;true&#8221;<br />
Option &#8220;DontZap&#8221; &#8220;true&#8221;<br />
EndSection<br />
EOF<br />
Firewalling<br />
Make sure iptables is installed</p>
<p># pacman -S iptables</p>
<p>Configure iptables. Here I choose to only allow HTTP/HTTPS ports in output, and deny everything in input (except ping and SSH in)<br />
TODO : allow FTP out<br />
TODO : SSH connection rate limiting</p>
<p># nano /etc/iptables/iptables.rules</p>
<blockquote><p>*filter<br />
:INPUT DROP [0:0]<br />
:FORWARD DROP [0:0]<br />
:OUTPUT DROP [0:0]<br />
# Already established input connections<br />
-A INPUT -m state &#8211;state RELATED,ESTABLISHED -j ACCEPT<br />
# allow traffic on loopback<br />
-A INPUT -i lo -j ACCEPT<br />
-A OUTPUT -o lo -j ACCEPT<br />
# allow ping in<br />
-A INPUT -p icmp &#8211;icmp-type echo-request -j ACCEPT<br />
-A OUTPUT -p icmp &#8211;icmp-type echo-reply -j ACCEPT<br />
# allow ping out<br />
-A OUTPUT -p icmp &#8211;icmp-type echo-request -j ACCEPT<br />
-A INPUT -p icmp &#8211;icmp-type echo-reply -j ACCEPT<br />
# allow dns traffic out<br />
-A OUTPUT -p udp &#8211;dport 53 -j ACCEPT<br />
# allow SSH in<br />
-A INPUT -p tcp &#8211;dport 22 -m state &#8211;state NEW,ESTABLISHED -j ACCEPT<br />
-A OUTPUT -p tcp &#8211;sport 22 -m state &#8211;state ESTABLISHED -j ACCEPT<br />
# allow HTTP/HTTPS out<br />
-A OUTPUT -j ACCEPT -p tcp -m multiport &#8211;dports 80,443<br />
# reject the rest<br />
-A INPUT -p tcp -j REJECT &#8211;reject-with tcp-reset<br />
-A INPUT -p udp -j REJECT &#8211;reject-with icmp-port-unreachable<br />
-A INPUT -j REJECT &#8211;reject-with icmp-proto-unreachable<br />
COMMIT</p></blockquote>
<p>Start the firewall</p>
<p># rc.d start iptables</p>
<p>Don&#8217;t forget to update /etc/rc.conf to start iptables (before network daemon) at boot time</p>
<p># nano /etc/rc.conf</p>
<blockquote><p>DAEMONS=(syslog-ng iptables @network @crond @alsa @sshd)</p></blockquote>
<p>Test your firewall from another machine with nmap<br />
TCP scan</p>
<p># nmap &lt;ip of target machine&gt;</p>
<p>UDP scan</p>
<p># nmap -sU &lt;ip of target machine&gt;<br />
Making the system read-only<br />
Several steps are needed to make sure the system will run correctly when the root filesystem is turned read-only.<br />
Link /var/lock and /var/run to /run (tmpfs)</p>
<p># ln -sf /run/lock /var/lock<br />
# ln -sf /run /var/run</p>
<p>Link /etc/resolv.conf to /tmp/resolv.conf (this is necessary for the dhcpcd client to work properly)</p>
<p># ln -sf /tmp/resolv.conf /etc/resolv.conf</p>
<p>Edit /etc/fstab<br />
add the following lines :</p>
<blockquote><p>tmpfs           /tmp            tmpfs   nodev,nosuid,rw      0       0<br />
tmpfs           /var/tmp      tmpfs   nodev,nosuid,rw      0       0<br />
tmpfs           /var/log       tmpfs   nodev,nosuid,rw      0       0</p></blockquote>
<p>And don&#8217;t forget to set / with the ro attribute :</p>
<blockquote><p>UUID=xxxxxxxxxxxxx       /       ext4    defaults,noatime,ro     0       1</p></blockquote>
<p>Note : with read-only filesystems we use no swap partition. So you have to ensure your computer has enough RAM to operate properly (at least 256M suggested).</p>
<p>The trick is that the user profile will be copied into ram (/tmp) at boot time, so we ensure the profile does not contain unwanted data and is the smallest possible to retain fast boot times :<br />
- delete bash history, temporary files and other unwanted data<br />
- delete history and cache for ALL web browsers (you may as well completely disable disk cache in each browser)<br />
- delete downloaded files<br />
etc<br />
To see how big is your profile</p>
<p>$ du -m -d 1 ~ |sort -g</p>
<p>When everything is ready, create the archived /home (use of lzop compression algorithm for the fastest decompression)</p>
<p># tar cvf /home.tlzop /home &#8211;lzop<br />
TIP: If you prefer to use a completely new, empty profile :<br />
- do not generate the archived home (the script in rc.local will automatically detect when it does not exist)<br />
- (optionally) erase /home/guest/</p>
<p>Finally, edit /etc/rc.local :</p>
<p># nano /etc/rc.local</p>
<blockquote><p>#!/bin/bash<br />
#<br />
# /etc/rc.local: Local multi-user startup script.<br />
#<br />
# login name of regular user (user account must exist!)<br />
MYUSER=&#8221;guest&#8221;<br />
MYHOMEARCHIVE=&#8221;/home.tlzop&#8221;<br />
# read-only filesystem trick :<br />
# extract /home directory archive to /tmp (in tmpfs)<br />
# and bind it to /tmp/home<br />
# create (empty) home/$MYUSER directory anyway just in case the archive doesn&#8217;t exist<br />
mkdir -m 700 -p /tmp/home/$MYUSER &amp;&amp; chown $MYUSER /tmp/home/$MYUSER<br />
# extract home archive if it exists (if not the user profile will be empty)<br />
[[ -f "$MYHOMEARCHIVE" ]] &amp;&amp; echo -n &#8220;Extracting archived home directory $MYHOMEARCHIVE to /tmp &#8230; &#8221; &amp;&amp; tar xf &#8220;$MYHOMEARCHIVE&#8221; -C /tmp &amp;&amp; echo &#8220;OK&#8221;<br />
mount &#8211;bind /tmp/home /home<br />
# start X as regular user<br />
su &#8211; $MYUSER -c startx &amp;<br />
exit 0</p></blockquote>
<p>The final touch<br />
Create a default homepage document</p>
<p># mkdir -p /usr/local/share/doc/homepage/<br />
# cat &gt;/usr/local/share/doc/homepage/index.html &lt;&lt;EOF<br />
&lt;h1&gt;Welcome to the Arch Linux Simple Lightweight Web Kiosk!&lt;/h1&gt;<br />
&lt;hr&gt;<br />
&lt;h2&gt;Useful hotkey shortcuts&lt;h2&gt;<br />
lorem ipsum&#8230;<br />
EOF</p>
<p>Now reboot your system, it will running in read-only mode. You may see some minor, non-blocking errors during boot (to be fixed&#8230; see /var/log/boot for more info).</p>
<p>Maintenance (&#8220;admin&#8221;) mode<br />
Want to update your system? Or add some modifications?<br />
Just boot in maintenance mode, enter your root password, and remount the filesystem so that it is writable again :</p>
<p># mount -o remount,rw /</p>
<p>If you want to update, start the network first</p>
<p># dhcpcd eth0<br />
# pacman -Syu</p>
<p>Note: when updating /home profiles, don&#8217;t forget to finally re-generate the /home.tlzop archive!</p>
<p># tar cvf /home.tlzop /home &#8211;lzop</p>
<p>End of modifications</p>
<p># reboot</p>
<p>(please note, on next reboot the system will -of course- be read-only, as in /etc/fstab)</p>
<p>How to create a bootable usb drive (2G or higher capacity needed)<br />
If you have installed this system on a non removable drive and want to create a bootable usb drive from it, follow these steps :<br />
Boot in Maintenance mode<br />
Plug your use drive and prepare it (all data will be erased!)</p>
<p># cfdisk /dev/sdX</p>
<p>(adjust with your actual drive letter)<br />
Create one bootable ext4 partition, save and quit cfdisk.<br />
Create an ext4 filesystem (still with no journalling to prevent premature wear &amp; tear of flash drives) and with a label (important)</p>
<p># mkfs.ext4 /dev/sdXy -O ^has_journal -L archusb001 -T small</p>
<p>for information purposes</p>
<p># tune2fs /dev/sdXy</p>
<p>Now mount usb drive and copy filesystem</p>
<p># mkdir /tmp/usb<br />
# mount /dev/sdXy /tmp/usb<br />
# time cp -avr {/bin,/boot,/etc,/home,/lib,/opt,/root,/sbin,/srv,/usr,/var} /tmp/usb</p>
<p>(will take a while&#8230;)<br />
Now we need to install the bootloader, so we chroot into our /tmp/usb</p>
<p># mkdir /tmp/usb/{dev,proc,run,sys,tmp}<br />
# mount &#8211;bind /dev /tmp/usb/dev<br />
# mount &#8211;bind /proc /tmp/usb/proc<br />
# mount &#8211;bind /sys /tmp/usb/sys<br />
# chroot /tmp/usb</p>
<p>adjust /etc/fstab, replace UUID with LABEL</p>
<p># nano /etc/fstab</p>
<blockquote><p>LABEL=&#8221;archusb001&#8243;/ext4defaults,noatime,ro01</p></blockquote>
<p>lilo.conf too needs several adjustments</p>
<p># nano /etc/lilo.conf</p>
<p>adjust the boot= line with your usb drive letter, or remove it since we can specify it from the command line :</p>
<blockquote><p>boot=/dev/sdX</p></blockquote>
<p>adjust every &#8220;root=&#8221; line in the image sections with the usb drive&#8217;s root partition label</p>
<blockquote><p>root=&#8221;LABEL=archusb001&#8243;</p></blockquote>
<p>finally, adjust every &#8220;initrd=&#8221; line (we want to be use the fallback image so that different hardware will be recognized)</p>
<blockquote><p>initrd=/boot/initramfs-linux-fallback</p></blockquote>
<p>Your lilo.conf now should look like (&#8220;optimized&#8221; version) :<br />
&lt;paste lilo.conf&gt;<br />
Save and write lilo to disk /dev/sdX</p>
<p># lilo -v -b /dev/sdX</p>
<p>Another important thing : we need to rebuild the initramfs with the &#8220;usb&#8221; hook added</p>
<p># nano /etc/mkinitcpio.conf</p>
<p>add &#8220;usb&#8221; just before &#8220;filesystems&#8221; in the HOOKS array :</p>
<blockquote><p>HOOKS=&#8221;base udev autodetect pata scsi sata usb filesystems usbinput fsck&#8221;</p></blockquote>
<p># mkinitcpio -p linux</p>
<p>Done, unmount everything and reboot on your usb drive!</p>
<p># exit<br />
# cd &amp;&amp; umount /tmp/usb/{dev,proc,sys,.}</p>
<p>check filesystem just to be sure</p>
<p># fsck.ext4 -y /dev/sdXy<br />
# reboot</p>
<p>Conclusion</p>
<p>I&#8217;m sure there&#8217;s still plenty of details I have forgotten, and plenty of room for improvement. Your feedback is appreciated.<br />
Now it&#8217;s your turn to play, share your experiences, boot times, etc!</p>
<p>Useful links and resources<br />
<a href="https://wiki.archlinux.org/index.php/Arch_Install_Scripts">https://wiki.archlinux.org/index.php/Arch_Install_Scripts</a><br />
<a href="https://wiki.archlinux.org/index.php/Fstab">https://wiki.archlinux.org/index.php/Fstab</a><br />
<a href="https://sites.google.com/site/linuxpendrive/rorootfs">https://sites.google.com/site/linuxpendrive/rorootfs</a><br />
<a href="http://www.jfc.org.uk/software/lwm.html">http://www.jfc.org.uk/software/lwm.html</a><br />
<a href="http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#Allowing_WWW_And_SSH_Access_To_Your_Firewall">http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#Allowing_WWW_And_SSH_Access_To_Your_Firewall</a><br />
<a href="http://www.thegeekstuff.com/2011/06/iptables-rules-examples/">http://www.thegeekstuff.com/2011/06/iptables-rules-examples/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=149&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/07/31/building-a-simple-lightweight-web-kiosk-system-with-arch-gnulinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>
	</item>
		<item>
		<title>Arch Linux on the HP Pavilion DM1-3xxx notebook (AMD E-350 &#8220;Zacate&#8221; based series)</title>
		<link>http://agentoss.wordpress.com/2012/04/15/arch-linux-on-the-hp-pavilion-dm1-3xxx-notebook-amd-e-350-zacate-based-series/</link>
		<comments>http://agentoss.wordpress.com/2012/04/15/arch-linux-on-the-hp-pavilion-dm1-3xxx-notebook-amd-e-350-zacate-based-series/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 13:53:55 +0000</pubDate>
		<dc:creator>AgentOss</dc:creator>
				<category><![CDATA[Arch]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[3130]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[DM1]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[lightweight]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[zacate]]></category>

		<guid isPermaLink="false">http://agentoss.wordpress.com/?p=135</guid>
		<description><![CDATA[Computer specs http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02694402&#38;lang=en&#38;cc=us&#38;taskId=101&#38;prodSeriesId=5032670&#38;prodTypeId=321957 Specs will vary, my model is the 3130. Goal of this tutorial To quickly setup a functional, lightweight Arch Linux system, optimized for our portable computer. This guide may evolve during time as I try to improve my Linux experience Download Arch iso (for the latest official release) https://www.archlinux.org/download/ (or for the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=135&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1><span class="Apple-style-span" style="font-weight:normal;font-size:medium;"><br />
</span></h1>
<h1><span class="Apple-style-span" style="font-weight:normal;font-size:medium;">Computer specs</span></h1>
<div><a href="http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02694402&amp;lang=en&amp;cc=us&amp;taskId=101&amp;prodSeriesId=5032670&amp;prodTypeId=321957">http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c02694402&amp;lang=en&amp;cc=us&amp;taskId=101&amp;prodSeriesId=5032670&amp;prodTypeId=321957</a></div>
<div></div>
<div>Specs will vary, my model is the 3130.</div>
<div></div>
<div></div>
<h2>Goal of this tutorial</h2>
<div>To quickly setup a functional, lightweight Arch Linux system, optimized for our portable computer.</div>
<div></div>
<div>This guide may evolve during time as I try to improve my Linux experience <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<div><span id="more-135"></span></div>
<h2>Download Arch iso</h2>
<div>(for the latest official release)</div>
<p><a href="https://www.archlinux.org/download/">https://www.archlinux.org/download/</a></p>
<p>(or for the latest snapshot build)</p>
<p><a href="http://releng.archlinux.org/isos/">http://releng.archlinux.org/isos/</a></p>
<div></div>
<div></div>
<div>Copy iso to USB pen drive (replace sdX with your drive, type fdisk -l to see drive list)</div>
<div></div>
<div>WARNING! WILL WIPE ALL DATA!</div>
<div></div>
<pre># dd if=archlinux-*.iso of=/dev/sdX bs=1M</pre>
<div></div>
<h2>Installation</h2>
<div></div>
<div></div>
<div>Boot your HP DM1 with the USB pen drive</div>
<div></div>
<h2>Update 2012/08/21</h2>
<div></div>
<div>Arch installation has changed since the first version of this tutorial. Please refer to the official installation guide here :</div>
<div></div>
<div><a href="https://wiki.archlinux.org/index.php/Installation_Guide">https://wiki.archlinux.org/index.php/Installation_Guide</a></div>
<div></div>
<div>then the post-installation guide :</div>
<div></div>
<div><a href="https://wiki.archlinux.org/index.php/Beginners%27_Guide/Post-Installation">https://wiki.archlinux.org/index.php/Beginners%27_Guide/Post-Installation</a></div>
<div></div>
<div></div>
<div></div>
<h2>Configuring our new system</h2>
<div></div>
<div>Login as root.</div>
<div></div>
<div>We need to setup a network connection, let&#8217;s do it with the internal wireless adapter (reminder : the wifi chipset on this system is a Ralink RT5390 which is natively supported by the Linux kernel since version 3.0.1)</div>
<div></div>
<div>If you&#8217;re using a WPA protected access point like I do, you need to set up wpa_supplicant :</div>
<div></div>
<pre># cd /etc
# cp wpa_supplicant.conf wpa_supplicant.conf.backup
# nano wpa_supplicant.conf</pre>
<p>I use the simplest network configuration :</p>
<div></div>
<pre>network=(
  ssid="your_ssid"
  psk="your_passphrase"
)</pre>
<p>(delete all other examples)</p>
<div></div>
<div>For security</div>
<pre># chmod 600 wpa_supplicant.conf</pre>
<div>Up the wireless interface</div>
<pre># ip link set wlan0 up</pre>
<div>Then start wpa_supplicant as a daemon, in the background</div>
<pre># wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf</pre>
<div>Get an IP address from your local dhcp server</div>
<pre># dhcpcd wlan0</pre>
<div></div>
<div>NOTE : if you prefer to use the wired network interface, simply plug your cable and do</div>
<pre># ip link set eth0 up &amp;&amp; dhcpcd eth0</pre>
<div></div>
<div>If all is well, let&#8217;s update the whole system</div>
<pre># pacman -Syu</pre>
<div>From now on, you might want to open a SSH session from another computer to copy and paste commands from this tutorial.</div>
<pre># pacman -S openssh</pre>
<p>Start the openssh daemon :</p>
<pre># /etc/rc.d/sshd start
or
# rc.d start sshd</pre>
<div>If you wan sshd to be started at boot :</div>
<pre># nano /etc/rc.conf</pre>
<p>then append @sshd to the DAEMONS array (the &#8216;@&#8217; prefix means that the daemon will be forked in the background)</p>
<div></div>
<div>Then login as root, on your notebook, from another system.</div>
<div></div>
<div></div>
<div>Configuring the soundcard</div>
<div></div>
<div>Let&#8217;s install the alsa utils</div>
<pre># pacman -S alsa-utils</pre>
<div></div>
<p>Set up the sound mixer</p>
<pre># alsactl init; alsamixer</pre>
<div>Use F6 to select the sound interface &#8220;HDA ATI SB&#8221;, adjust the volumes then ESC.</div>
<div></div>
<div>Don&#8217;t forget to save settings</div>
<pre># alsactl store</pre>
<div>Add the alsa daemon in /etc/rc.conf</div>
<pre># nano /etc/rc.conf</pre>
<div>DAEMONS=(syslog-ng network crond @sshd @alsa)</div>
<div></div>
<div></div>
<div>Now we need to tell the system to use the &#8220;HDA ATI SB&#8221; controller by default (and not the HDMI audio output)</div>
<pre># cat &gt;/etc/modprobe.d/alsa.conf &lt;&lt;EOF
alias snd-card-0 snd-hda-intel
alias sound-slot-0 snd-hda-intel
options snd_hda_intel index=1
EOF</pre>
<div>Be sure that our user (here the superuser) is in the &#8216;audio&#8217; group!</div>
<pre># usermod -a -G audio root</pre>
<div>(reboot for changes to take effect)</div>
<div></div>
<div>Finally, test basic sound output</div>
<pre># aplay /usr/share/sounds/alsa/Noise.wav
or
# speaker-test</pre>
<div>If you like to test mp3 playback :</div>
<pre># pacman -S mpg123 &amp;&amp; cd &amp;&amp; wget http://storage.newjamendo.com/download/track/82293/mp32/Overture%20in%20Darkness.mp3 &amp;&amp; mpg123 "Overture in Darkness.mp3"</pre>
<div></div>
<div>Disable the painful speaker beeps!</div>
<pre># nano /etc/inputrc</pre>
<div>Uncomment the line :</div>
<div></div>
<div>set bell-style none</div>
<div></div>
<div></div>
<div></div>
<div>Creating a regular user</div>
<div></div>
<pre># adduser</pre>
<div>Additional groups : audio,video,optical,storage</div>
<div></div>
<div></div>
<div>Set default colors and font for virtual consoles</div>
<div># nano /etc/profile</div>
<div></div>
<div>Append at the end of the file :</div>
<div></div>
<pre>setterm -clear all -background black -foreground cyan -store
setfont Lat2-Terminus16</pre>
<div></div>
<div>(the setting are applied only after the user logs in)</div>
<div></div>
<h2>Installing X.Org</h2>
<div></div>
<div>Still as root</div>
<pre># pacman -S xf86-input-evdev xf86-input-synaptics xf86-video-ati xorg-server xorg-xinit xterm ttf-liberation xorg-xsetroot xorg-xmodmap xorg-xinput
# startx</pre>
<div>Should be working, except for the keymap (&#8220;setxkbmap &lt;keymap&gt;&#8221; can help!). And we have no window manager yet.</div>
<div></div>
<div>Installing a minimal, tiling window manager : dwm</div>
<div><a href="https://wiki.archlinux.org/index.php/Dwm">https://wiki.archlinux.org/index.php/Dwm</a></div>
<div></div>
<pre># pacman -S dwm dmenu</pre>
<div>Create our .xinitrc (adjust your keymap)</div>
<pre># cat &gt;~/.xinitrc &lt;&lt;EOF
setxkbmap fr
xterm &amp;
exec dwm
EOF</pre>
<div>Start X again</div>
<pre># startx</pre>
<div>We can play with some default keyboard shortcuts within dwm :</div>
<div></div>
<div>&lt;Left SHIFT&gt; + &lt;Left ALT&gt; + &lt;RETURN&gt; : open a new xterm</div>
<div>&lt;Left SHIFT&gt; + &lt;Left ALT&gt; + q : exit dwm (and X)</div>
<div>&lt;Left ALT&gt; + p : launch dmenu (dynamic menu)</div>
<div></div>
<pre># man dwm</pre>
<p>for more!</p>
<div></div>
<p><strong>Updated 04/21/2012</strong></p>
<p>(Optional but recommended) Compile and install dwm (using ABS -the Arch Building System)</p>
<p>First, install ABS and the development environment, then run abs to download the abs files for dwm<br />
# pacman -Sy abs base-devel &amp;&amp; abs &#8220;community/dwm&#8221;</p>
<p>As a regular user, create a build directory in your home<br />
$ mkdir -p $HOME/abs<br />
then copy dwm&#8217;s build directory into it<br />
$ cp -r /var/abs/community/dwm/ ~/abs<br />
$ cd ~/abs/dwm</p>
<p>Get the source files<br />
$ makepkg -o</p>
<p>Edit dwm&#8217;s config.h to your taste (French users have a look at <a href="http://wiki.archlinux.fr/DWM">http://wiki.archlinux.fr/DWM</a>)<br />
Also some nice color schemes here : <a href="http://fsk141.com/dwm-colors">http://fsk141.com/dwm-colors</a><br />
$ nano config.h</p>
<p>Then compile and install with<br />
$ makepkg -efi</p>
<div></div>
<h2>Autologin into X</h2>
<div><a href="https://wiki.archlinux.org/index.php/Start_X_at_boot">https://wiki.archlinux.org/index.php/Start_X_at_boot</a></div>
<div></div>
<div>I choose not to use an X session manager (xdm, slim, gdm, &#8230;) but still want to start X automatically when I login from tty1.</div>
<div></div>
<div>For locking ttys, we need vlock</div>
<pre># pacman -S vlock</pre>
<div>Edit .bash_profile startup script</div>
<pre>$ nano ~/.bash_profile</pre>
<div>add the following lines at the end of the file :</div>
<div></div>
<pre># automatically start X when login from tty1 (and lock the tty)
if [ -z "$DISPLAY" ] &amp;&amp; [ $(tty) == /dev/tty1 ]; then
nohup startx &gt;.xlog &amp; vlock
fi</pre>
<div>Security note : be sure to close all opened tty sessions when locking your computer <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<h2>Tweaking the touchpad</h2>
<div><a href="https://wiki.archlinux.org/index.php/Touchpad_Synaptics">https://wiki.archlinux.org/index.php/Touchpad_Synaptics</a></div>
<div></div>
<div>Right now, touchpad behaviour is quite strange, no regular right click button support, no scroller&#8230; Let&#8217;s try to improve that.</div>
<div></div>
<div>By default :</div>
<div>- a 1-finger tap will emulate the left mouse button (button number 1)</div>
<div>- a 2-finger tap will emulate the middle mouse button (scroller button) (button number 2)</div>
<div>- a 3-finger tap will emulate the right mouse button (button number 3)</div>
<div></div>
<div>Edit the configuration file for the touchpad under X</div>
<pre># nano /etc/X11/xorg.conf.d/10-synaptics.conf</pre>
<div>add/modify the following options :</div>
<div></div>
<pre># used for the synclient command line
Option "SHMConfig" "on"
# for vertical scroll on the right edge of the touchpad
Option "VertEdgeScroll" "1"
# left mouse button
Option "TapButton1" "1"
# I prefer a 2-finger tap for the right mouse button
Option "TapButton3" "2"
# and a 3-finger tap for the middle mouse button
Option "TapButton2" "3"
# one tap in the right top corner of the touchpad will emulate a right mouse button
Option "RTCornerButton" "3"</pre>
<div></div>
<div>Remember that you can tweak with the synclient command in an X terminal</div>
<pre># synclient -l
# synclient VertEdgeScroll=1</pre>
<div>Don&#8217;t hesitate to experiment, and share your findings <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<h2>Special function keys</h2>
<div></div>
<div>We have special function keys (using the &#8220;fn&#8221; dead key) like brightness up/down&#8230; which work out of the box.</div>
<div></div>
<div>And some other keys do nothing, like the &#8220;globe/internet&#8221; (fn+F5) key, or the volume up/down keys.</div>
<div></div>
<div>We can configure them using xev and xbindkeys :</div>
<pre># pacman -S xorg-xev xbindkeys</pre>
<div>Now in an xterm, launch xev</div>
<pre>$ xev</pre>
<p>Now press the fn+F5 keys, xev reports KeyPress/KeyRelease events with keycode number 180.</p>
<div></div>
<div>Note : the &#8220;xbindkeys -k&#8221; command does the same thing and is easier to use!</div>
<div></div>
<div>Generate default configuration file for xbindkeys and add our program hotkey</div>
<pre>$ xbindkeys --defaults &gt; $HOME/.xbindkeysrc
$ nano $HOME/.xbindkeysrc</pre>
<div>Add the following lines :</div>
<div></div>
<pre>"firefox"
 c:180</pre>
<div>Note : this keycode is also recognized by the X server as &#8220;XF86HomePage&#8221;</div>
<div></div>
<div>Then run the xbindkeys daemon (it will fork in the background automatically)</div>
<pre>$ xbindkeys</pre>
<div>Try your new hotkey, it works!</div>
<div>(Note : if using dwm, by default Firefox will open on the virtual screen number 9)</div>
<div></div>
<div>Remember to add xbindkeys to your .xinitrc.</div>
<div></div>
<div>Note : the &#8220;?&#8221; (fn+F1) key seems to send the same keycode as a simple F1&#8230;</div>
<div></div>
<div></div>
<div>Let&#8217;s configure the audio volume up/down/toggle keys while we are at it :</div>
<div></div>
<pre>"amixer set Master 5-"
 XF86AudioLowerVolume
"amixer set Master 5+"
 XF86AudioRaiseVolume
"amixer set Master toggle"
 XF86AudioMute</pre>
<div></div>
<div>Tip : Control+Shift+q shows all xbindkeys bindings</div>
<div></div>
<div></div>
<div>The &#8220;Menu&#8221; key</div>
<div></div>
<div>The Menu key on the right of the keyboard, is the one who emulates a right-mouse button click under Windows. We want the same here.</div>
<div>Unfortunately, the xmodmap method for binding the key to a mouse button :</div>
<pre>$ xmodmap -e "keycode 135 = Pointer_Button3"</pre>
<p>does not work.</p>
<div></div>
<div>Workaround with xte from the xautomation package.</div>
<pre># pacman -S xautomation
$ nano ~/.xbindkeysrc</pre>
<div>add the following to your .xbindkeysrc :</div>
<div></div>
<pre>"xte 'mouseclick 3'"
 Menu</pre>
<div>Restart xbindkeys.</div>
<div></div>
<div>Note : solution is not 100% satisfactory, works more or less depending on the applications (works good in Firefox, not so much in an LXTerminal).</div>
<div>I have tested xdotool as well, same problems!</div>
<div></div>
<div></div>
<div></div>
<div>XScreensaver (power management)</div>
<pre># pacman -S xscreensaver</pre>
<div>Then under an xterm, as a regular user, run</div>
<pre>$ xscreensaver-demo</pre>
<p>to configure it.</p>
<div></div>
<div>Be sure to add it to your .xinitrc</div>
<pre>$ nano ~./xinitrc</pre>
<div>add a line</div>
<div></div>
<pre>xscreensaver -nosplash &amp;</pre>
<div>before the line launching your window manager.</div>
<div></div>
<div></div>
<h2>Power Management</h2>
<div></div>
<div>Since this is a notebook, power management has to be optimized.</div>
<div></div>
<div>CPU frequency</div>
<div><a href="https://wiki.archlinux.org/index.php/PowerNow">https://wiki.archlinux.org/index.php/PowerNow</a></div>
<div></div>
<pre># pacman -S cpufrequtils
# cpufreq-info</pre>
<p>tells us that there is no cpu frequency driver enabled</p>
<div></div>
<div>So we load the drivers&#8217; modules</div>
<pre># modprobe powernow-k8 &amp;&amp; modprobe cpufreq_ondemand &amp;&amp; modprobe cpufreq_powersave
# cpufreq-info</pre>
<p>much better!</p>
<div></div>
<div>Now for the settings to remain at boot time</div>
<div></div>
<div>Add the modules to the MODULES array in our /etc/rc.conf</div>
<div>MODULES=(powernow-k8 cpufreq_ondemand cpufreq_powersave)</div>
<div></div>
<div>and the cpufreq daemon in the DAEMONS array</div>
<div>DAEMONS=(syslog-ng network crond @sshd @alsa @cpufreq dbus)</div>
<div></div>
<div></div>
<div>Then edit cpufreq configuration</div>
<pre># nano /etc/conf.d/cpufreq</pre>
<div>uncomment the line</div>
<div></div>
<div>governor=&#8221;ondemand&#8221;</div>
<div></div>
<div>Now reboot or start the cpufreq daemon manually</div>
<pre># rc.d start cpufreq</pre>
<div>Install Laptop-mode-tools and other useful tools</div>
<pre># pacman -S laptop-mode-tools acpi acpid ethtool powertop upower</pre>
<div>Note : you can check battery level anytime with</div>
<pre>$ acpi</pre>
<div></div>
<h2>Configure laptop-mode</h2>
<div></div>
<div>Main configuration file is /etc/laptop-mode/laptop-mode.conf</div>
<div></div>
<div>I did not change the defaults here.</div>
<div></div>
<div></div>
<div>Personalize LCD brightness levels</div>
<pre># nano /etc/laptop-mode/conf.d/lcd-brightness.conf</pre>
<div>CONTROL_BRIGHTNESS=1</div>
<div></div>
<div># lowest brightness when on battery</div>
<div>BATT_BRIGHTNESS_COMMAND=&#8221;echo 1&#8243;</div>
<div># highest brightness when on AC power</div>
<div>LM_AC_BRIGHTNESS_COMMAND=&#8221;echo 10&#8243;</div>
<div>NOLM_AC_BRIGHTNESS_COMMAND=&#8221;echo 10&#8243;</div>
<div>BRIGHTNESS_OUTPUT=&#8221;/sys/class/backlight/acpi_video0/brightness&#8221;</div>
<div></div>
<div>Bluetooth management</div>
<pre># nano /etc/laptop-mode/conf.d/bluetooth.conf</pre>
<div>I like to disable bluetooth when on battery (hell, I never use it anyway!)</div>
<div></div>
<div># Control bluetooth?</div>
<div>CONTROL_BLUETOOTH=1</div>
<div></div>
<div># Enable bluetooth on battery</div>
<div>BATT_ENABLE_BLUETOOTH=0</div>
<div></div>
<div># Enable bluetooth on AC</div>
<div>AC_ENABLE_BLUETOOTH=1</div>
<div></div>
<div># Bluetooth interfaces to enable/disable</div>
<div>BLUETOOTH_INTERFACES=&#8221;hci0&#8243;</div>
<div></div>
<div></div>
<div></div>
<div>Start laptop-mode daemon</div>
<pre># rc.d start laptop-mode</pre>
<div>You can see if it works by unplugging/plugging the power cord and have a look at the logs (and your screen&#8217;s brightness of course!)</div>
<pre># tail /var/log/messages.log</pre>
<div>Also useful</div>
<pre># laptop-mode status</pre>
<div>Add laptop-mode daemon to the DAEMONS array</div>
<div>DAEMONS=(syslog-ng network crond @sshd @alsa @cpufreq @acpid @laptop-mode dbus)</div>
<div></div>
<div>Run powertop for useful advice</div>
<pre># powertop</pre>
<div></div>
<div>IMPORTANT : disable wake-on-lan using ethtool, otherwise battery will be drained when computer is off! (WOL is enabled by default in the BIOS)</div>
<pre># nano /etc/rc.local.shutdown</pre>
<div>add the lines :</div>
<div></div>
<div>ip link set eth0 up</div>
<div>ethtool -s eth0 wol d</div>
<div></div>
<div></div>
<div></div>
<h2>Suspend to ram/suspend to disk (hibernate)</h2>
<div><a href="https://wiki.archlinux.org/index.php/Pm-utils">https://wiki.archlinux.org/index.php/Pm-utils</a></div>
<div></div>
<div>Install the pm-utils</div>
<pre># pacman -S pm-utils</pre>
<div>Test suspend to RAM</div>
<pre># pm-suspend</pre>
<p>It seems to work! Now press a key to wake up.</p>
<div></div>
<div></div>
<div>Put the computer in suspend mode (and lock the session) when closing the lid</div>
<div>Update 05/13/2012 : hibernate with Power Button.</div>
<div></div>
<div>This is handled by the acpid daemon</div>
<div><a href="https://wiki.archlinux.org/index.php/Acpid">https://wiki.archlinux.org/index.php/Acpid</a></div>
<div></div>
<pre># nano /etc/acpi/handler.sh</pre>
<div>&#8230;</div>
<div></div>
<div>    button/power)<br />
echo &#8220;PowerButton pressed!&#8221;&gt;/dev/tty5<br />
case &#8220;$2&#8243; in<br />
PBTN|PWRF)  logger &#8220;PowerButton pressed: $2&#8243;<br />
xs=$(ps up $(pidof xscreensaver) | awk &#8216;/xscreensaver/ {print $1}&#8217;)<br />
if test $xs; then su $xs -c &#8220;xscreensaver-command -lock&#8221;; fi<br />
/usr/sbin/pm-hibernate<br />
;;<br />
*)          logger &#8220;ACPI action undefined: $2&#8243; ;;<br />
esac<br />
;;</div>
<div></div>
<div>&#8230;.</div>
<div></div>
<div>    button/lid)</div>
<div>        case &#8220;$3&#8243; in</div>
<div>            close)</div>
<div>                #echo &#8220;LID closed!&#8221;&gt;/dev/tty5</div>
<div></div>
<div>                # The lock command need to be run as the user who owns the xscreensaver process and not as root.</div>
<div>                # See: man xscreensaver-command. $xs will have the value of the user owning the process, if any.</div>
<div></div>
<div>                xs=$(ps up $(pidof xscreensaver) | awk &#8216;/xscreensaver/ {print $1}&#8217;)</div>
<div>                if test $xs; then su $xs -c &#8220;xscreensaver-command -lock&#8221;; fi</div>
<div>                  /usr/sbin/pm-suspend</div>
<div>                ;;</div>
<div></div>
<div>&#8230;</div>
<div></div>
<div></div>
<div>Test hibernation (suspend to disk)</div>
<div></div>
<div>We first need to set the resume partition in grub! (the swap partition is used, that&#8217;s why we chose a big swap partition size -equalling RAM size- when installing the system)</div>
<pre># blkid</pre>
<p>then copy/paste the UUID for the swap partition, into the grub line</p>
<pre># nano /boot/grub/menu.lst</pre>
<div>your kernel line should look something like this (UUIDs will be different of course)</div>
<div></div>
<div>kernel /vmlinuz-linux root=/dev/disk/by-uuid/c87172c8-52f5-4d0d-8c7a-6db9c571852f resume=/dev/disk/by-uuid/3fe7d979-f61d-42cc-9333-ef8de4a0ee10 ro</div>
<div></div>
<div>Next, we need to enable the &#8220;resume&#8221; hook in the initramfs, otherwise resuming will fail.</div>
<pre># nano /etc/mkinitcpio.conf</pre>
<div>in the HOOKS array, add &#8220;resume&#8221; just before &#8220;filesystems&#8221;, like this :</div>
<div></div>
<div>HOOKS=&#8221;base udev autodetect pata scsi sata resume filesystems usbinput fsck&#8221;</div>
<div></div>
<div>TIP : set COMPRESSION to &#8220;lzop&#8221; for faster boot (you need to install the lzop package before issuing the mkinitcpio command)</div>
<div></div>
<div>Then regenerate the initramfs</div>
<pre># mkinitcpio -p linux</pre>
<div>Now, try to hibernate</div>
<pre># pm-hibernate</pre>
<div>Normally the computer will power down. Restart it.</div>
<div></div>
<div>Resuming should now work! If not, check the logs</div>
<pre># more /var/log/pm-*.log</pre>
<div></div>
<div>This is a kind of victory for me here, since nearly all the distros I tried on this machine before (see here) could not hibernate/resume properly!</div>
<div></div>
<div></div>
<h2>Allow regular users to use pm-suspend / pm-hibernate</h2>
<div></div>
<div>Install and configure sudo</div>
<pre># pacman -S sudo &amp;&amp; visudo
%wheel ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend 
%wheel ALL=(ALL) NOPASSWD: /usr/sbin/pm-hibernate
<code>%wheel ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend-hybrid</code></pre>
<div>Don&#8217;t forget to add your regular user account into the wheel group</div>
<pre># usermod -a -G wheel &lt;username&gt;</pre>
<div></div>
<div>It&#8217;s easy to add a hotkey (in this example, Mod4 (the &#8220;Windows&#8221; key) + Escape) for hibernation, via xbindkeys</div>
<pre>$ nano $HOME/.xbindkeysrc</pre>
<div></div>
<pre>"xscreensaver-command -lock; sudo /usr/sbin/pm-hibernate"
 Mod4 + Escape</pre>
<div></div>
<div></div>
<div>Now that hibernation works flawlessly, I like to configure laptop-mode for automatic hibernation when battery level is critically low</div>
<pre># nano /etc/laptop-mode/conf.d/auto-hibernate.conf</pre>
<div>Set ENABLE_AUTO_HIBERNATION=1</div>
<div></div>
<div>Restart laptop-mode</div>
<pre># rc.d restart laptop-mode</pre>
<div>What about playing a nice beep song when this happens?</div>
<pre># pacman -S beep
# nano /usr/share/laptop-mode-tools/module-helpers/pm-hibernate</pre>
<div>Add some beep commands like this :</div>
<div></div>
<pre># Freezer on preference
if [ x$MEM = x1 ]; then
        beep -r 3
        echo "mem" &gt; /sys/power/state
elif [ x$DISK = x1 ]; then
        beep -r 5
        echo "disk" &gt; /sys/power/state
else
        ## Nothing to do.
        echo ;
fi</pre>
<div></div>
<h2>Automatically suspend on idle/inactivity (under X.Org)</h2>
<div></div>
<div>Add to your ~/.xinitrc :</div>
<div>
<pre><code>xautolock -time 15 -locker "sudo pm-suspend-hybrid" &amp;</code></pre>
</div>
<div>(I find that pm-suspend-hybrid is convenient in this case)</div>
<div></div>
<h2>Useful monitoring software</h2>
<div></div>
<div>System utilities (htop, smartmontools)</div>
<pre># pacman -S htop smartmontools</pre>
<div>Test hard drive health</div>
<pre># smartctl -H /dev/sda</pre>
<div></div>
<h2>Better network handling</h2>
<div></div>
<div>with wicd</div>
<pre># pacman -S wicd
# rc.d restart dbus
# rc.d start wicd</pre>
<div>Add wicd daemon to your rc.conf, after the dbus daemon.</div>
<div></div>
<div>To scan wireless networks and connect (as a regular user)</div>
<pre>$ wicd-curses</pre>
<div>Note : connection profiles are stored in /var/lib/wicd/configurations/</div>
<div></div>
<div></div>
<h2>Firewall</h2>
<div></div>
<div>Install the Uncomplicated firewall</div>
<pre># pacman -S ufw</pre>
<div>If you are currently connected on your notebook via SSH, and to allow future incoming SSH connections</div>
<pre># ufw allow 22/tcp</pre>
<div>then start the ufw daemon</div>
<pre># nano /etc/ufw/ufw.conf</pre>
<div>Set ENABLED to yes, then start ufw</div>
<pre># rc.d start ufw</pre>
<div>Check status</div>
<pre># ufw status
# iptables -L |more</pre>
<div>Remember to add &#8220;ufw&#8221; to your DAEMONS array in /etc/rc.conf, just before the &#8220;network&#8221; daemon.</div>
<div></div>
<div></div>
<div></div>
<div></div>
<h2>Let&#8217;s install some software for workstation usage</h2>
<div></div>
<div>A better terminal emulator : lxterminal</div>
<pre># pacman -S lxterminal</pre>
<div>Lightweight file manager : PCManFM</div>
<pre># pacman -S pcmanfm</pre>
<div>Web browser : Mozilla Firefox (with some useful extensions, gracefully packaged by the Arch community)</div>
<pre># pacman -S firefox arch-firefox-search firefox-adblock-plus firefox-noscript</pre>
<div>(You are able to watch HTML5 videos, on youtube and others, out of the box without any flash plugin)</div>
<div></div>
<div>TIP : disable disk cache to reduce disk spin-up and thus save battery. In Firefox, type &#8220;<strong>about:config</strong>&#8221; in the URL bar, then set <strong>browser.cache.disk.enable</strong> to <strong>false</strong>. (then type &#8220;<strong>about:cache</strong>&#8221; to verify).</div>
<div></div>
<div>Email client : Mozilla Thunderbird</div>
<pre># pacman -S thunderbird</pre>
<div>(TIP: For better looking fonts, be sure to select Liberation-serif and Liberation-sans in all Mozilla applications)</div>
<div></div>
<div>Video players/recorders : MPlayer / MEncoder / ffmpeg and VLC</div>
<pre># pacman -S mplayer mencoder ffmpeg vlc</pre>
<div>Test your webcam with mplayer</div>
<pre>$ mplayer tv://</pre>
<p>or</p>
<pre>$ mplayer tv:// -tv driver=v4l2:width=320:height=240:fps=30</pre>
<div>You even can capture video from webcam with mencoder</div>
<pre>$ mencoder -tv driver=v4l2:width=640:height=480 tv:// -o webcam.avi -ovc lavc=mpeg4 -nosound</pre>
<p>(here with no sound because mencoder complains about missing /dev/dsp sound device&#8230;)</p>
<div></div>
<div>ffmpeg is great for recording too (ideal for screencasts), here is an example for screen capture</div>
<pre>$ ffmpeg -f x11grab -s 1366x768 -r 15 -i :0.0 -sameq capture.flv</pre>
<p>(without sound)</p>
<pre>$ ffmpeg -f alsa -i hw:0 -f x11grab -s 1366x768 -r 15 -i :0.0 -sameq capture.avi</pre>
<p>(with sound, using the internal mic. Check your capture levels with alsamixer)</p>
<div></div>
<div>Note : webcam light stays on even after capture has finished. Know a fix anyone?</div>
<div></div>
<div></div>
<div>Audio player : Audacious</div>
<pre># pacman -S audacious audacious-plugins</pre>
<div>Bind the special keys &#8220;rewind&#8221;, &#8220;forward&#8221;, &#8220;play/pause&#8221; on our keyboard with audacious</div>
<pre>$ nano $HOME/.xbindkeysrc</pre>
<div>Add the following :</div>
<div></div>
<div>&#8220;audacious -r&#8221;</div>
<div> XF86AudioPrev</div>
<div></div>
<div>&#8220;audacious -f&#8221;</div>
<div> XF86AudioNext</div>
<div></div>
<div>&#8220;audacious -t&#8221;</div>
<div> XF86AudioPlay</div>
<div></div>
<div>Then restart xbindkeys</div>
<pre>$ killall xbindkeys &amp;&amp; xbindkeys</pre>
<div>Neat feature, now even if Audacious is not launched, a simple hotkey will launch it and resume playing the current playlist <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<h2>Some small beautification tips!</h2>
<div></div>
<div>Set desktop wallpaper with feh</div>
<pre># pacman -S feh</pre>
<div>Go and download a super nice wallpaper at <a href="http://interfacelift.com/">http://interfacelift.com/</a></div>
<div>(then as a regular user)</div>
<pre>$ feh --bg-center &lt;wallpaper filename&gt;</pre>
<p>will generate a ~/.fehbg</p>
<div></div>
<div>add the line to your xinitrc :</div>
<div></div>
<pre>eval $(cat ~/.fehbg)</pre>
<div>before the final &#8220;exec&#8221; line.</div>
<div></div>
<div>When you want to change the wallpaper, simply re-run</div>
<pre>$ feh --bg-center &lt;new wallpaper filename&gt;</pre>
<div></div>
<div></div>
<div>Change default GTK theme</div>
<pre># pacman -S gnome-themes-standard gnome-themes-extras lxappearance
$ lxappearance</pre>
<div>Be sure to choose an icon theme too, for applications such as PCManFM to have correct icons.</div>
<div></div>
<div>TIP: Use a BIG mouse cursor in GTK apps!</div>
<pre>$ echo &gt;~/.gtkrc-2.0.mine "gtk-cursor-theme-size=48"</pre>
<div>(be sure to have a .gtkrc-2.0 file &#8211; normally created by lxappearance &#8211; which includes your .mine file)</div>
<div></div>
<div></div>
<div><strong>Updated 05/13/2012</strong></div>
<div></div>
<div>This computer model comes with a glossy LCD screen (the biggest drawback on this computer). In order to improve user experience when using it in the sunlight, I have found that setting the desktop GTK theme to &#8220;HighContrast&#8221; can help. so I wrote a  small bash script which can be invoked with a hotkey (xbindkeys), which would switch the theme on and off.</div>
<div></div>
<div>We will need a small program from the AUR : <strong>gtkrc-reload</strong> ( <a href="http://aur.archlinux.org/packages.php?ID=44052">http://aur.archlinux.org/packages.php?ID=44052</a> )</div>
<div>Download it and install it :</div>
<div>$ cd ~/AUR</div>
<div>$ wget <a href="http://aur.archlinux.org/packages/gt/gtkrc-reload/gtkrc-reload.tar.gz" rel="nofollow">http://aur.archlinux.org/packages/gt/gtkrc-reload/gtkrc-reload.tar.gz</a></div>
<div>$ tar xvzf gtkrc-reload*</div>
<div>$ cd gtkrc-reload &amp;&amp; makepkg -i</div>
<div></div>
<div>Copy the <strong>gtk-switch-hicontrast.sh</strong> (look at the end of this tutorial) to your ~/bin directory (create it if needed). Don&#8217;t forget to :</div>
<div>$ chmod +x ~/bin/gtk-switch-hicontrast.sh</div>
<div></div>
<div>Now we can add the hotkey to switch from normal GTK 2.0 theme to HiContrast (here it will be Mod4 + h):</div>
<div>$ nano ~/.xbindkeysrc</div>
<div></div>
<div>&#8220;$HOME/bin/gtk-switch-hicontrast.sh&#8221;<br />
Mod4 + h</div>
<div></div>
<div>As usual, save and restart xbindkeys.</div>
<div></div>
<div>Other tips to improve readability : set your terminals/virtual consoles  with high contrast colors.</div>
<div>Be sure to set the LCD backlight to the max (at the expense of the battery).</div>
<div></div>
<h1>Conclusion</h1>
<div></div>
<div>Arch Linux is a great distro for better understanding of how Linux systems work.</div>
<div>And remember, the Arch wiki is a goldmine <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div></div>
<div></div>
<h1>Things To Do</h1>
<div></div>
<div>
<ul>
<li>mail alerts from smartmontools daemon if hard drive fails?</li>
<li><del>hibernation with the Power Button (not detected by acpid?)</del></li>
<li><del>automatically suspend when computer has been inactive for X minutes</del></li>
<li>install a launch panel?</li>
<li>re-install from scratch and use encrypted partitions!</li>
</ul>
</div>
<div></div>
<div></div>
<div></div>
<h1>Some simple custom scripts</h1>
<h2>battery.sh</h2>
<div></div>
<div>
<pre>#!/bin/bash
# battery.sh
batt_now=`cat /sys/class/power_supply/BAT0/energy_now`
batt_full=`cat /sys/class/power_supply/BAT0/energy_full`
batt_status=`cat /sys/class/power_supply/BAT0/status`
voltage_now=`cat /sys/class/power_supply/BAT0/voltage_now`
voltage_now_w=`echo "scale=2;$voltage_now / 1000000" | bc`
voltage_min_design=`cat /sys/class/power_supply/BAT0/voltage_min_design`
voltage_min_design_w=`echo "scale=2;$voltage_min_design / 1000000" | bc`
power_now=`cat /sys/class/power_supply/BAT0/power_now`
batt_level=`echo "scale=2;$batt_now/$batt_full*100" | bc`
conso=`echo "scale=2;$power_now / 1000000" | bc`

#echo "batt_full=$batt_full"
#echo "batt_now=$batt_now"
echo "Battery level : $batt_level % (status : $batt_status, $voltage_now_w V, min $voltage_min_design_w V)"
echo "System power consumption : $conso W"</pre>
</div>
<div></div>
<div></div>
<h2>wifi.sh</h2>
<div></div>
<pre>#!/bin/bash
# wifi.sh
killall dhcpcd
killall wpa_supplicant
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf
dhcpcd wlan0</pre>
<h1>gtk-switch-hicontrast.sh</h1>
<pre>#!/bin/bash
#
# gtk-switch-hicontrast.sh
#
# switch current user's gtk 2.0 theme (to hicontrast and back)
#
# http://agentoss.wordpress.com / fredo696@gmail.com
#
# this script is best used when called with a hotkey
#
# useful for laptops with a glossy lcd panel!
# for best results set the backlight luminosity to the max.
# 
# dependencies (mandatory) : gnome-themes-standard (should include the hicontrast themes)
# dependencies (optional) : zenity, lxappearance,
# gtkrc-reload from the AUR ( http://aur.archlinux.org/packages.php?ID=44052 )
# 
# 
# Note : if you already have a .mine gtkrc file, please back it up
# before using this script because it will be overwritten!
# 
# be sure that your .gtkrc-2.0 has an include directive like :
# include "~/.gtkrc-2.0.mine" as the last line
#

# file for storing the actual switch value ("NORMAL" or "HI")
hifileswitch="$HOME/.hicontrast"

# gtkrc file to write changes to
gtkfile_mine="$HOME/.gtkrc-2.0.mine"

# check if file is readable or writable
touch $hifileswitch
if [ $? -ne 0 ];then
 echo "Error touching $hifileswitch, aborting!"
 exit 1
fi

# get current switch value
hivalue=`cat $hifileswitch`

if [ ! $hivalue == "HI" ];then
 zenity --info --text="Switching gtk theme to HiConstrast.nnPlease restart all running GTK apps for changes to take full effect" 
  --timeout=2
 echo "HI" &gt;$hifileswitch
# populate .mine file with highcontrast values (customize yours here)
# here I choose a bigger font size and a bigger mouse cursor
 cat &gt;$gtkfile_mine &lt;&lt;EOF
# generated by $0
# do not modify this file by hand, it will be overwritten!
gtk-theme-name="HighContrast"
gtk-icon-theme-name="HighContrast"
gtk-font-name="Sans 14"
#gtk-cursor-theme-name="Bluecurve"
gtk-cursor-theme-size=48
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"
gtk-xft-rgba="rgb"
EOF

else
# switching back to normal theme
 zenity --info --text="Switching gtk theme to normal" --timeout=2

# customize your "normal" (ie. not high contrast) .mine file here
# here it is an empty file so that no values in the default gtkrc-2.0 file
# are overridden
 cat &gt;$gtkfile_mine &lt;&lt;EOF
# generated by $0
# do not modify this file by hand, it will be overwritten!
EOF

 echo "NORMAL" &gt;$hifileswitch
fi

# force gtk theme reload
# unfortunately, icons are not refreshed it seems
# so we need to restart manually all running gtk apps...
gtkrc-reload || lxappearance

exit 0</pre>
<h1>The Config files</h1>
<div></div>
<h2>/etc/rc.conf</h2>
<div></div>
<div>
<pre>#
# /etc/rc.conf - Main Configuration for Arch Linux
#
# See 'man 5 rc.conf' for more details
#
# LOCALIZATION
# ------------
HARDWARECLOCK="UTC"
TIMEZONE="Europe/Paris"
KEYMAP="fr"
CONSOLEFONT="Lat2-Terminus16"
CONSOLEMAP=
LOCALE="fr_FR.UTF-8"
DAEMON_LOCALE="yes"
USECOLOR="yes"
# HARDWARE
# --------
MODULES=(powernow-k8 cpufreq_ondemand cpufreq_powersave)
USEDMRAID="no"
USEBTRFS="no"
USELVM="no"
# NETWORKING
# ----------
HOSTNAME=dm1z
interface=
address=
netmask=
broadcast=
gateway=
NETWORK_PERSIST="no"
# DAEMONS
# -------
#
DAEMONS=(syslog-ng ufw network crond @sshd @alsa @cpufreq @acpid @laptop-mode dbus @wicd)</pre>
</div>
<div></div>
<div></div>
<h2>/etc/wpa_supplicant.conf</h2>
<div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;">ctrl_interface=/var/run/wpa_supplicant</span></div>
<pre>eapol_version=1
ap_scan=1
fast_reauth=1
network={
        ssid="your_ssid"
        psk="your_passphrase"
}</pre>
<div></div>
<div></div>
<div></div>
<h2>$HOME/.xinitrc</h2>
<div>
<pre>eval $(cat ~/.fehbg)
setxkbmap fr
xbindkeys
xscreensaver -nosplash &amp;
<code>xautolock -time 15 -locker "sudo pm-suspend-hybrid" &amp;</code>
#xterm &amp;
#xterm -fg white -bg black -e htop &amp;
while true; do xsetroot -name "`acpi | tr -d 'n'; echo -n " // "; date +%R; sleep 60`"; done &amp;
exec dbus-launch dwm</pre>
</div>
<div></div>
<div></div>
<h2>$HOME/.xbindkeysrc</h2>
<div>
<pre>"xbindkeys_show"
  control+shift + q

"lxterminal"
 Mod4 + x

"firefox"
 c:180

"firefox"
 Mod4 + f

"thunderbird"
 Mod4 + t
"$HOME/bin/gtk-switch-hicontrast.sh"
 Mod4 + h 
"xscreensaver-command -lock; sudo /usr/sbin/pm-suspend"
 Mod4 + s

"xscreensaver-command -lock; sudo /usr/sbin/pm-hibernate"
 Mod4 + Escape

"audacious -r"
 XF86AudioPrev

"audacious -f"
 XF86AudioNext

"audacious -t"
 XF86AudioPlay

"amixer set Master 5-"
 XF86AudioLowerVolume

"amixer set Master 5+"
 XF86AudioRaiseVolume

"amixer set Master toggle"
 XF86AudioMute

"xte 'mouseclick 3'"
 Menu</pre>
</div>
<h1>Mandatory screenshot</h1>
<p><a href="http://agentoss.files.wordpress.com/2012/04/2012-04-15-181521_1366x768_scrot.png"><img class="alignnone size-medium wp-image-140" title="2012-04-15-181521_1366x768_scrot" src="http://agentoss.files.wordpress.com/2012/04/2012-04-15-181521_1366x768_scrot.png?w=300&#038;h=168" alt="" width="300" height="168" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agentoss.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agentoss.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agentoss.wordpress.com&#038;blog=20578388&#038;post=135&#038;subd=agentoss&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agentoss.wordpress.com/2012/04/15/arch-linux-on-the-hp-pavilion-dm1-3xxx-notebook-amd-e-350-zacate-based-series/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://storage.newjamendo.com/download/track/82293/mp32/Overture%20in%20Darkness.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://storage.newjamendo.com/download/track/82293/mp32/Overture%20in%20Darkness.mp3" length="0" type="audio/mpeg" />
	
		<media:content url="http://1.gravatar.com/avatar/d417d6983844b55a781eaea9b1a99672?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">agentoss</media:title>
		</media:content>

		<media:content url="http://agentoss.files.wordpress.com/2012/04/2012-04-15-181521_1366x768_scrot.png?w=300" medium="image">
			<media:title type="html">2012-04-15-181521_1366x768_scrot</media:title>
		</media:content>
	</item>
	</channel>
</rss>
