Archive

Posts Tagged ‘ubuntu’

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.

Installing git for webdav access the kernel.org way

February 17th, 2009 No comments

This how to is strongly based on the official kernel.org howto. It has been applied to a Ubuntu server 8.10 installation.

First we install apache 2.2:

apt-get install apache2 git-core

We create our repository and the needed data structure:

cd /var/www
mkdir my-new-repo.git
cd my-new-repo.git
git --bare init
chown -R www-data.www-data .

We enable the dav module for apache:

a2enmod dav_fs

Now we configure apache:

vim /etc/apache2/conf.d/git.conf

We can add now the following configuration:

<Location /my-new-repo.git>
        DAV on
        AuthType Basic
        AuthName "Git"
        AuthUserFile /etc/apache2/passwd.git
        Require valid-user
</Location>

Now we can add a user to our git repository:

htpasswd -c /etc/apache2/passwd.git <user>

Now we can restart the apache web server in order to apply our changes:

/etc/init.d/apache2 restart

Installing apache 2.2, proftpd, fcgi and mysql on Ubuntu

February 16th, 2009 No comments

This how to shows you a way to install a LAMP system on a fresh Ubuntu server installation.

First we bring our package management into a current state:

sudo su
apt-get update
apt-get upgrade

Then we can install mysql, php, proftpd and apache:

apt-get install mysql-server mysql-client
apt-get install apache2.2-common apache2-mpm-worker apache2-threaded-dev
apt-get install php5-cgi libapache2-mod-fcgid apache2-suexec php-apc php5-gd php5-imagick
apt-get install proftpd
-> select "Servermode"

Now we create the users and group basic configuration:

addgroup ftpuser
cp /bin/false /bin/ftp
echo "/bin/ftp" >> /etc/shells

We create a user default, that receives all remaining requests:

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

We can create now an Apache vHost for the default user:

cd /etc/apache2/sites-available/
a2dissite default
rm def* -> remove the old default configuration
vim default

You can insert this configuration for default:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        SuexecUserGroup default ftpuser
        ServerName www.domain.tld
        ServerAlias more.domains.tld
        DocumentRoot /var/www/default/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/default/domain/html>
                FCGIWrapper /var/www/php-fcgid-scripts/default/php-fcgid-starter .php
                Options +ExecCGI
                order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/www/default/domain/log/apache_error.log

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

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

First we make the general fcgi configuration:

cd /etc/apache2/mods-available
vim fcgid.conf

We can use the following configuration:

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .php
  SocketPath /var/lib/apache2/fcgid/sock
  IPCConnectTimeout 20
</IfModule>

Then we can configure fcgi for the user:

a2enmod suexec
cd /var/www
mkdir php-fcgid-scripts
chown root:root /var/www/php-fcgid-scripts
cd php-fcgid-scripts
mkdir default
cd default
touch php-fcgid-starter
chmod +x php-fcgid-starter
vim php-fcgid-starter

We can use the following configuration:

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

Now you should assign the proper rights to it:

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

We create a php.ini file for this vHost:

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

Now we can test it:

cd /var/www/default/domain/html
touch index.php
echo "<? phpinfo(); ?>" >> /var/www/default/domain/html/index.php
chown default.ftpuser /var/www/default/domain/html/index.php
a2ensite default
/etc/init.d/apache2 restart

Now you can call www.domain.tld with your favorite browser.

Installing turbinado

February 9th, 2009 1 comment

This is a how to for all that want to install turbinado on a fresh Ubuntu server 8.10 with OpenSSH Server selected.

First get your distribution into a current state:

sudo su
apt-get update
apt-get upgrade

Install needed packages:

apt-get install libedit-dev darcs git-core libgmp3-dev zlib1g-dev postgresql postgresql-server-dev-8.3 happy make libffi-dev

Install the current 6.10.1 version of ghc, the version of the package system is currently still 6.8.2

cd /usr/local/src
wget http://haskell.org/ghc/dist/6.10.1/ghc-6.10.1-i386-unknown-linux-libedit2.tar.bz2
tar xjvf ghc-6.10.1-i386-unknown-linux-libedit2.tar.bz2
cd ghc-6.10.1
./configure
make install

The next step is to install cabal:

cd /usr/local/src
wget http://www.haskell.org/cabal/release/cabal-1.6.0.2/Cabal-1.6.0.2.tar.gz
tar xzvf Cabal-1.6.0.2.tar.gz
cd Cabal-1.6.0.2
ghc --make Setup
./Setup configure
./Setup build
sudo ./Setup install

Now install the helpfull cabal-install tool, which is a package management for haskell libraries.

We can install the latest version from darcs:

cd /usr/local/src
darcs get --partial http://darcs.haskell.org/cabal-install/
cd cabal-install
sh bootstrap.sh

Or install the tar package:

cd /usr/local/src
wget http://www.haskell.org/cabal/release/cabal-install-0.6.2/cabal-install-0.6.2.tar.gz
tar xzvf cabal-install-0.6.2.tar.gz
cd cabal-install-0.6.2
sh bootstrap.sh

Because we installed all packages to our home directory, we have to add this directory to our environment, we can do this by adding the path as follows:

vim /etc/environment
–> Add youre local bin path and reload the path (we have to reboot anyway because of previous kernel upgrades)
I had to add the following path: /root/.cabal/bin/
reboot

or:

echo "export PATH=$PATH: /root/.cabal/bin/" >> ~/.bashrc

Now we can use cabal to install libraries, but first we have to update cabal.

cabal update

Because of some problems with the cabal crypt package I had to build the crypt package directly from the repository:

cd /usr/local/src
darcs get http://code.haskell.org/crypto
cd crypto
cabal install

Now we install the HDBC driver that allows us to connect to databases:

cd /usr/local/src
wget http://hackage.haskell.org/packages/archive/HDBC/2.1.0/HDBC-2.1.0.tar.gz
tar xzvf HDBC-2.1.0.tar.gz
cd HDBC-2.1.0
cabal install

Now we can finally install the turbinado web server via cabal:

cd /usr/local/src
git clone git://github.com/alsonkemp/turbinado-website.git
cd turbinado-website
cabal install

Database setup info (to be added)

We have to hide the HTTP-4000 package:

ghc-pkg hide HTTP-4000.0.4

And now we can run it:

cd /usr/local/src/turbinado-website
turbinado -p 8080
-> this will start turbinado and makes it listen to port 8080

Now you can open the turbinado wesite in your favorite browser:

http://your-webserver-ip-or-name:8080/Home