Archive

Archive for the ‘Linux’ Category

Install postgresql on Ubuntu with php5

October 16th, 2009 No comments

In this installation we integrate postgresql into this apache installation.

First we refresh our package management and our packages:

apt-get update
apt-get upgrade

Then we have to install the basic packages:

apt-get install postgresql postgresql-server-dev-8.3 php5-pgsql

Now we have to do the basic setup of the postgresql server:

sudo -u postgres psql template1

Now you can define a passwort for the postgres user:

\password postgres

To leave the prompt enter:

\q
Categories: PHP, Ubuntu, postgresql Tags:

Install phpPgAdmin on Ubuntu

October 16th, 2009 No comments

In order to use this how to you have to install apache first following this how to. Also postgresql has to be installed, therefore you can follow this how to.

First we create a new user:

useradd -g ftpuser -d /var/www/pga -s /bin/ftp -m pga
chown pga.www-data /var/www/pga
chmod 750 /var/www/pga
mkdir /var/www/pga/conf
mkdir -p /var/www/pga/domain/{cgi-bin,exec,html,log,session,temp}
chmod 770 /var/www/pga/domain/temp
chmod 777 /var/www/pga/domain/session
chmod 700 /var/www/pga/domain/exec
chown -R pga.ftpuser /var/www/pga/*
rm -rf /var/www/pga/.b*
rm -rf /var/www/pga/.p*

Then we create a vHost for the new pga user:

cd /etc/apache2/sites-available/
vim pga

We add the following configuration:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        SuexecUserGroup pga ftpuser
        ServerName www.domain.tld
        ServerAlias more.domains.tld
        DocumentRoot /var/www/pga/domain/html
        DirectoryIndex index.php index.html index.htm

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory />
                Order Deny,Allow
                Deny from All
        </Directory>

        <Directory /var/www/pga/domain/html>
                FCGIWrapper /var/www/php-fcgid-scripts/pga/php-fcgid-starter .php
                Options +ExecCGI
                order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/www/pga/domain/log/apache_error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/www/pga/domain/log/apache_access.log combined
        ServerSignature On
</VirtualHost>

Now we create the fcgi configuration:

cd /var/www/php-fcgid-scripts/
mkdir pga
cd pga
touch php-fcgid-starter
chmod +x php-fcgid-starter
vim php-fcgid-starter

Now we add the configuration:

#!/bin/sh
PHPRC="/var/www/pga/conf"
export PHPRC
PHP_FCGI_CHILDREN=15
export PHP_FCGI_CHILDREN
exec /usr/bin/php5-cgi

We configure the proper rights:

chown -R pga.ftpuser /var/www/php-fcgid-scripts/pga
chmod 755 /var/www/php-fcgi-scripts/pga/php-fcgi-starter
chattr -V +i /var/www/php-fcgid-scripts/pga/php-fcgid-starter

We create a php.ini file for this vHost:

cd /var/www/pga/conf
wget http://www.naumann.cc/wp-content/uploads/2009/10/php.ini
chown root.root php.ini

Now we download the pgaPgAdmin interface:

cd /var/www/pga/domain/
su -m pga
wget http://downloads.sourceforge.net/project/phppgadmin/phpPgAdmin%20%5Bstable%5D/phpPgAdmin-4.2.2/phpPgAdmin-4.2.2.tar.bz2?use_mirror=mesh
tar xjvf phpPgAdmin-4.2.2.tar.bz2

Then we copy all files into the html directory:

mv phpPgAdmin-4.2.2/* html/

Now we have to configure the postgresql server for the usage of phpPgAdmin:

vim /etc/postgresql/8.3/main/postgresql.conf

Ennable the following line:

listen_addresses = 'localhost'

Create a new user for phpPgAdmin:

sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb

Change the authentication settings in the following file to allow access via phpPgAdmin via this user:

vim /etc/postgresql/8.3/main/pg_hba.conf

Add this line:

local   all         myuser                             md5

before:

local   all         all                               ident sameuser
Categories: PHP, Ubuntu, apache, postgresql Tags:

Install a dyndns client on Ubuntu

October 16th, 2009 No comments

This how to will guide you through the process of installing a dynamic dns service client on Ubuntu.

First we update our package manager:

apt-get update
apt-get upgrade

Now that we have a current system we can install the new package:

apt-get install ddclient

Select your dyndns provider from the list, for me it’s www.dyndns.com.

Enter the domain name that should be updated into the following field.

Enter your user name and password.

In the next dialog you have to enter the network device whos ip where the domain name should be resolved to.

For me this is eth0.

You can change the settings also via the config file:

vim /etc/ddclient.conf

My file looks as follows:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

pid=/var/run/ddclient.pid
protocol=dyndns2
use=if, if=eth0
server=members.dyndns.org
login=username
password='password'
host.dyndns.biz
Categories: Ubuntu, dyndns Tags:

IMAP mail account migration

June 29th, 2009 No comments

I moved my email account to FastMail.fm and had to migrate an imap mailbox via my ubuntu desktop. If you want to join them feel free to use my link with referal code :) FastMail.fm

First we have to install the imapsync package:

sudo apt-get install imapsync

Then we have to trigger the migration:

imapsync --syncinternaldates \
  --host1 mail.source.tld --authmech1 LOGIN --user1 user@domain.tld --password1 secret \
  --host2 mail.target.tld --authmech2 LOGIN --user2 user@domain.tld --password2 secret

Now drink a coffee :D , because this can take a while.

Categories: IMAP, Linux, Mail, Ubuntu Tags:

Syncronize time on ubuntu

June 18th, 2009 No comments

This how to is based on the ubuntu documentation. First we have to add the basic packages:

sudo apt-get install ntp ntpdate

Than we have to do some basic configuration:

echo "ntpdate ntp.ubuntu.com pool.ntp.org " >> /etc/cron.daily/ntpdate
sudo chmod 755 /etc/cron.daily/ntpdate
echo "server ntp.ubuntu.com" >> /etc/ntp.conf
echo "server pool.ntp.org" >> /etc/ntp.conf

Have a look at this page for more ntp Servers.

I had to change my timezone as well, this can be done by changing a symbolic link:

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

Just replace Europe/Berlin by your timezone. You can find more information about changing timezones here.

Categories: Linux, Ubuntu Tags:

Adding madwifi support to easy peasy

June 17th, 2009 No comments

As descibed here we have to install the kernel headers first:

sudo apt-get install build-essential linux-headers-$(uname -r) subversion

Now we can add the madwifi drivers for the wlan chipset:

cd /usr/local/src
svn checkout http://madwifi-project.org/svn/madwifi/trunk madwifi
cd madwifi
make
sudo make install
sudo modprobe ath_pci

You can find some additional Information of putting madwifi into a kernel at this page. (German)

We have to do some additional configuration first we have to add the module to /etc/modules:

echo "ath_pci" >> /etc/modules

I added some scripts following the howto.

Categories: Linux, Ubuntu, easy peasy Tags:

Screen and ubuntu 9.04

June 16th, 2009 No comments

We have to install the screen package first:

apt-get install screen

We add the following at the end of the configuration file:

vim /etc/screenrc
hardstatus string "%h%? users: %u%?"
startup_message off
hardstatus alwayslastline "Redmine: %-Lw%{= BW}%50>%n%f*   %t%{-}%+Lw%<"
bindkey -k k7 prev
bindkey -k k8 next

Now you can open a screen session:

screen
screen -r
-> resume a screen session
screen -x
-> join a screen session

When you start screen:

CTRL - A then CTRL - D
-> exit screen
CTRL - A then CTRL - C
-> new tab
CTRL - D
-> close window (when all are closed screen will be terminated)
CTRL - A then CTRL-D
-> exit screen without terminating tabs
Categories: Linux, Ubuntu Tags:

creating a kernel 2.6.30 deb file

June 16th, 2009 No comments

If you want to create your own debian style packaged kernel you can follow this guide.

First we open a shell and install the necessary packages to create kernels under ubuntu:

sudo apt-get install kernel-package build-essential libncurses5-dev bin86 subversion-tools

Get the newest vanilla kernel, best practice would be to put it into /usr/src.

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2
tar xjvf linux-2.6.30.tar.bz2
cd linux-2.6.30

Now we can update the symlink:

rm -rf linux && ln -s /usr/src/linux-2.6.30 linux && cd /usr/src/linux

The we load the old configuration and then we launch the command line interface:

sudo cp /boot/config-$(uname -r) .config && yes "" | make oldconfig
cd /usr/src/linux-2.6.30
sudo make menuconfig

Now you can change what ever you want for you own custom kernel, after this we can clean the kernel and then we can trigger the creation of our new kernel:

sudo make-kpkg clean
sudo make-kpkg --revision eee701 kernel_image

If you want to know more about make-kpkg, have a look at this page. (German)
Some ubuntu specific information can be found here.

To install the kernel run:

sudo dpkg -i linux-image-2.6.30_eee701_i386.deb
Categories: Linux, Netbook, Ubuntu Tags:

Install msmpt-mta on ubuntu 9.04

April 1st, 2009 No comments

This will install msmtp-mta on your computer, a nice little mta that uses for example gmail for outgoing mails.

We install the packages:

sudo apt-get install msmtp-mta

We change the config file:

vim /etc/msmtprc

A sample file for google:

account gmail_robomailer
host smtp.gmail.com
port 587
auto_from off
auth on
user yourAccount@googlemail.com
password yourPassword
tls on
tls_starttls on
from yourAccount@googlemail.com
maildomain googlemail.com
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile
syslog LOG_MAIL
account default: gmail_robomailer

For further details check:

man msmtp

Sample usage from a php.ini file:

sendmail_path = /usr/bin/msmtp -t -i

To test if the setup was successful you can send your self a mail via command line:

cat <<EOF | msmtp -a gmail_robomailer some@email.tld
From: yourAccount@googlemail.com
To: some@email.tld
Subject: test

This is a test!
EOF
Categories: Linux, smtp Tags: , , ,

Install Redmine 0.8.1 on Ubuntu Server 9.04

April 1st, 2009 7 comments

This howto is based on Chris’s howto. It has been tested and modified to work with ubuntu server 9.04.

First we change to root and install the base packages:

sudo su
apt-get install apache2 ruby rubygems subversion ruby-pkg-tools \
ruby1.8-dev build-essential postgresql libdbd-pg-perl libapache2-svn \
libapache-dbi-perl libapache2-mod-perl2 libdigest-sha1-perl \
libopenssl-ruby librmagick-ruby git-core git ruby-dev

Now we install the ruby gems:

gem install rails -v 2.1.2
gem install rake -v 0.8.3
gem install mongrel mongrel_cluster postgres-pr --include-dependencies

We add the gems to $PATH:

echo "export PATH=$PATH:/var/lib/gems/1.8/bin" >> ~/.bashrc

Now we setup the database, there for we first change to the postgres user:

su postgres

Now we create a database user and a database for redmine, in this howto we use redmine as password for the redmine user.

createuser redmine --no-superuser --no-createdb --no-createrole --login --pwprompt --encrypted
createdb --owner=redmine --encoding=utf-8 redmine
exit

We create a user for redmine and some user specific directories:

addgroup redmine
useradd -g redmine -s /bin/false -m redmine

Now we proceed installing redmine it self from svn into a new created directory:

cd /var/www/rails_apps/redmine
svn co http://redmine.rubyforge.org/svn/tags/0.8.1/
ln -s 0.8.1 redmine

We can now configure database access for redmine:

vim /var/www/rails_apps/redmine/config/database.yml

Add the following information:

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: redmine

Now we boostrap the database:

rake rails:update
rake db:migrate RAILS_ENV="production"
rake redmine:load_default_data RAILS_ENV="production"

Change some rights:

cd /var/www/rails_apps/redmine
mkdir tmp public/plugin_assets
sudo chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

To configure your email settings change the following file:

vim /var/www/rails_apps/redmine/config/email.yml

Default content:

# Outgoing email settings

production:
  delivery_method: :smtp
  smtp_settings:
    address: smtp.example.net
    port: 25
    domain: example.net
    authentication: :login
    user_name: redmine@example.net
    password: redmine

development:
  delivery_method: :smtp
  smtp_settings:
    address: 127.0.0.1
    port: 25
    domain: example.net
    authentication: :login
    user_name: redmine@example.net
    password: redmine

Now we can try to run redmine from it’s directory:

cd /var/www/rails_apps/redmine
mongrel_rails start --environment=production
or we can use WebRick
ruby script/server webrick -e production

It uses port 3000 as default, thus you can call redmine at:


http://yourIP:3000

To logon, enter username admin and password admin.

If you want to use a svn repository via http you can configure it when creating a project via the redmine interface. If you use https for your repository, you should check it out once locally on the webserver first with the redmine user that has been used to start redmine. You have to accept the certificate permanently, and then redmine can use it as well.

I would suggest to run redmin in a screen session, there fore we install screen.