Archive

Archive for October, 2010

DRBD för att skapa HA-system

October 20th, 2010 No comments

DRBD (Distributed Replicated Block Device) is a distributed storage system for theGNU/Linux platform. It consists of a kernel module, several userspace management applications and some shell scripts and is normally used on high availability (HA) clusters. DRBD bears similarities to RAID 1, except that it runs over a network.

DRBD refers to both the software (kernel module and associated userspace tools), and also to specific logical block devices managed by the software. DRBD device and DRBD block device are also often used for the latter.

It is free software released under the terms of the GNU General Public License version 2.

Ref: http://en.wikipedia.org/wiki/DRBD

Tips on how to set up a “heartbeat” system in Linux: http://www.associatedcontent.com/article/1930488/installing_and_configuring_heartbeat.html?cat=15

Categories: Linux Tags:

Cisco VPN i Ubuntu

October 19th, 2010 No comments

Cisco IPSec VPN:
http://mnshankar.wordpress.com/2010/05/17/ubuntu-10-04-and-vpn-at-uf-2/
http://www.nulldevice.de/2010/06/cisco-client-vpn-vpnc-ubuntu-linux-10-04/

Out of the box support for PPTP VPN in Ubuntu 10.04:
http://computergyan.wordpress.com/2010/04/21/out-of-the-box-support-for-pptp-vpn-in-ubuntu-10-04/

Here’s another university that uses the normal 10.04 network manager without vpnc to connect a PPTP VPN:
http://www1.umassd.edu/cits/wireless/vpn_linux.pdf

Read more about Ubuntu 10.04 and it’s pre-installed VPN:
https://wiki.ubuntu.com/VPN

Categories: Linux Tags:

Skicka massmail för att lasttesta server

October 19th, 2010 No comments

Here is a bash script that you could run to send yourself 5000 emails

Maybe start by 500 😉 ans wee how you coan connect with Thunderbird if you can go fast true all your email
Then I think youre server is okay

Put these line in a script called send-lot-mail.sh

#!/bin/bash

typeset -i nb=0

while [ $nb -lt 5000 ]
do

 echo -n .
 echo  "." | mail -s "test" PutYOurEmail@yoursomainhere.com
 nb=nb+1
 sleep 0.3

done
Categories: Bash, Linux Tags:

Lägg upp en skrivare i CentOS/RHEL

October 19th, 2010 No comments

This will add a HP JetDirect printer:

lpadmin -p printername -v socket://ipaddress_of_printer:9100

CUPS provides two methods for adding printers: a command-line program called lpadmin(8) and a Web interface. The lpadmin command allows you to perform most printer administration tasks from the command-line and is located in /usr/sbin. The Web interface is located at:

and steps you through printer configuration. If you don’t like command-line interfaces, try the Web interface instead.

Run the lpadmin command with the -p option to add a printer to CUPS:

    /usr/sbin/lpadmin -p printer -E -v device -m ppd ENTER

For a HP DeskJet printer connected to the parallel port this would look like:

    /usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd ENTER

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44 would be added with the command:

    /usr/sbin/lpadmin -p LaserJet -E -v socket://11.22.33.44 -m laserjet.ppd ENTER

As you can see, deskjet.ppd and laserjet.ppd are the PPD files for the HP DeskJet and HP LaserJet drivers included with CUPS. You’ll find a complete list of PPD files and the printers they will work with in Appendix C, “Printer Drivers”.

For a dot matrix printer connected to the serial port, this might look like:

    /usr/sbin/lpadmin -p DotMatrix -E -m epson9.ppd \
        -v serial:/dev/ttyS0?baud=9600+size=8+parity=none+flow=soft ENTER

Here you specify the serial port (e.g. S0,S1, d0, d1), baud rate (e.g. 9600, 19200, 38400, 115200, etc.), number of bits, parity, and flow control. If you do not need flow control, delete the “+flow=soft” portion.

The CUPS web server provides a user-friendly “wizard” interface for adding your printers. Rather than figuring out which device URI and PPD file to use, you can instead click on the appropriate listings and fill in some simple information. Enter the following URL in your web browser to begin:

Click on the Add Printer button to add a printer.

Ref: http://www.cups.org/doc-1.1/sam.html

Tips how to troubleshoot a deskjet printer in Ubuntu: http://www.experts-exchange.com/OS/Linux/Q_26926848.html?cid=1749

Categories: Linux, Red Hat / CentOS Tags:

Felsökning nätverk och WWW tjänst

October 19th, 2010 No comments
Verify it’s not a connection issue: Try to ping.
On the host when the interface is up do a ethtool eth0
If it is autoneg you should see a speed and duplex. Also the link at the bottom should say yes.
Do a tcpdump -i eth0 and make sure you can see traffic of any kind.
Then check if firewall is active with this command
service iptable status
The outpur should contain:
12   ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80
15   ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443
(12 and 15 are the sequence numbers and could be different than the numbers listed here)
Please check both boxes for /etc/sysconfig/iptables and see if both have these:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
If not add these lines and restart firewall:
service iptables restart
Troubleshoot the Apache daemon. Check if it is working with these commands:
netstat -anpt | grep http
Do you see anything like :
tcp        0      0 :::80                       :::*                        LISTEN      3717/httpd
tcp        0      0 :::443                      :::*                        LISTEN      3717/httpd
in the output?
If not please try to restart the daemon :
service httpd restart
If this fails please check the output from :
/var/log/messages
/var/log/httpd/access_log
/var/log/httpd/error_log

Categories: Linux, Red Hat / CentOS Tags:

Starta skript vid inloggning

October 19th, 2010 No comments
This is an example how to execute a script at logon to set the Java environment. Add a script named “java.sh” to add the variable in /etc/profile.d/ (with “execute” permissions) if you’re using bash as login shell:
/etc/profile.d/java.sh
export JAVA_HOME=/usr/java/j2k1.x.x
export PATH=$PATH:$JAVA_HOME/bin
The contents of profile.d will be automatically executed with every interactive logon.
When you logoff your shell will be removed from the memory along with the entire environment. But when you logon again it will be reestablished including your new java environment.
Categories: Linux, Red Hat / CentOS Tags:

Backup och återställning av Gnome Paneler

October 14th, 2010 No comments

För att återställa Gnome panelen kan man använda följande kommandon:

gconftool-2 --recursive-unset /apps/panel
rm -rf ~/.gconf/apps/panel
pkill gnome-panel
exit

Eller så kan man ladda ner ett skript som kan göra detta samt även ta backup på panelerna och återställa denna backup när man vill.

Se “Restore the Default Gnome Panels in Ubuntu“.

Ref: http://www.starryhope.com/linux/ubuntu/2010/restore-the-default-panels-in-ubuntu/

Categories: Linux Tags:

Skapa video och bilder med webm och webp

October 12th, 2010 No comments

On2 (ägs av Google) har skapat ett nytt öppet format för att spela upp video och bilder direkt i en HTML5 webbläsare. Officiell webbplats: www.webmproject.org

webm är en container som innehåller själva videon i VP8 format. Webbläsare som kommer stödja VP8 är Firefox 4, Opera 10.6 och Google Chrome.

För att konvertera videofiler till webm kan man ladda ner en programvara till Windows 32-bitars kallad Mirovideo ( www.mirovideoconverter.com ). Denna innehåller ffmpeg och codecs för VP8 samt Vorbis som används för att koda ljudet.

För att spela upp VP8 filer kan man använda VLC player, men man måste ha version 1.1 eller senare. Videoacceleration funkar inte i dagsläget med VP8, men det kommer i framtiden.

För att konvertera VP8 i Ubuntu krävs lite trix. Gör så här:

sudo apt-get remove ffmpeg x264 lib264-dev
sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall yasm \
texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev \
libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev \
libxfixes-dev libxvidcore-dev zlib1g-dev
mkdir ~/tmp
cd ~/tmp
git clone git://git.videolan.org/x264.git
cd x264
./configure
make
sudo checkinstall --pkgname=x264 --pkgversion "2:0.`grep X264_BUILD x264.h \
-m1 | cut -d' ' -f3`.`git rev-list HEAD | wc -l`+git`git rev-list HEAD -n 1 \
| head -c 7`" --backup=no --default
cd ~/tmp
git clone git://review.webmproject.org/libvpx.git
cd libvpx
./configure
make
sudo checkinstall --pkgname=libvpx --pkgversion="`date +%Y%m%d%H%M`-git" \
--backup=no --default
cd ~/tmp
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree \
--enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora \
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid \
--enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion "4:SVN-r`svn info | \
grep Revision | awk '{ print $NF }'`" --backup=no --default
hash x264 ffmpeg ffplay

Sedan kan du börja koda om ett MPG-klipp till webm/VP8 genom att skriva:

ffmpeg -i DITTKLIPP.MPG movie.webm

Och vill du ha lite mer kontroll på kodningen kan du använda:

ffmpeg -i DITTKLIPP.MPG -f webm -vcodec libvpx -acodec libvorbis \
-ab 160000 -sameq movie.webm

Lycka till!

Categories: Bash, Linux, Ubuntu Tags:

Koppla upp Citrix ICA klient i Ubuntu

October 10th, 2010 No comments

Ladda först ner Citrixklienten från Citrix. Klienten finns ännu inte med i de officiella programbiblioteken för Ubuntu. Du behöver .deb-paketet: http://citrix.com/English/SS/downloads/details.asp?downloadID=3323&productID=-1#top

Sen behöver du koppla “Citrix Receiver” programmet till .ica-filer i Nautilus (Gnomes filhanterare). När du klickar på en Citrix-länk på webben (ditt företags Citrixserver) kommer din webbläsare att spara en .ica-fil. Högerklicka på denna .ica-fil i Nautilus och välj “Öppna med / Annat program”. Bläddra dig sedan fram till wfica och öppna ica-filen (som troligen heter “launch.ica”). wfica finns (som standard) i mappen “/usr/lib/ICAClient“.

Nu kommer du troligen få “SSL error 61“. Detta beror på att Citrixklienten inte hittar rätt SSL certifikat. Du kan peka om så Citrixklienten läser SSL certifikaten i Mozilla Firefox SSL mapp. Detta görs enklast med följande skript:

#!/bin/bash
sudo mv /usr/lib/ICAClient/keystore/cacerts \ /usr/lib/ICAClient/keystore/cacerts_old
sudo cp /usr/lib/ICAClient/keystore/cacerts_old/* \ /usr/share/ca-certificates/mozilla/
sudo ln -s /usr/share/ca-certificates/mozilla \ /usr/lib/ICAClient/keystore/cacerts

Tipset kommer ursprungligen från denna sida: http://geekpete.com/blog/tech-guides/linux-citrix-client-error-61-ubuntu-810-intrepid-ibex

Mer tips om lösningar på “SSL error 61” finns här: http://forums.citrix.com/thread.jspa?threadID=72672

Använder du skriptet i länken blir det fel sökväg till cacerts och du får då “SSL error 5” (om Citrixklienten inte hittar några SSL cert alls). Använd mitt skript ovan istället så ska det funka (testat med Ubuntu 10.10, Citrix Receiver 11.100, Mozilla Firefox 3.6.10. OBS! Det verkar in funka med Chromium 6.0.472.63 som inte drar igång Citrix Receiver när man klickar på en ica-ikon).

Sedan om du försöker starta .ica-filen direkt i Nautilus får du fel “SSL error 38“. Starta istället via webbsidan som Citrixservern ligger på så ska det funka!

Categories: Linux, Ubuntu Tags:

Connect NAS

October 9th, 2010 No comments

If you have a Linux based NAS and would like to connect your Ubuntu client to it, first install nfs file system:

sudo apt-get install nfs-common

Then create a mount dir on your computer:

sudo mkdir /mnt/nas

Check so that you can ping the NAS:

ping nas

If it didn’t work you have to put the NAS in the host file /etc/hosts :

sudo nano /etc/hosts

Then try to connect to the NAS, e.g. to the Public share (if you have one):

sudo mount nas:/Public /mnt/nas

If it worked, add the following line to your /etc/fstab to automatically connect to the NAS when your user requests access to /mnt/nas :

sudo nano /etc/fstab

# <file system> <mount point> <type> <options> <dump> <pass>
nas:/Public /mnt/nas nfs rsize=8192,wsize=8192,timeo=14,intr,user 0 0

The ‘user’ switch makes it possible for an ordinary user to mount.

Map host folders in VirtualBox on an Ubuntu client

First, mount host addons though Virtual Box menus, install them and reboot the Ubuntu client. Then run:

sudo mkdir /mnt/vboxsrv
sudo mount -t vboxsf holm /mnt/vboxsrv

Done!

Categories: Bash, Linux, Ubuntu Tags: