Archive

Posts Tagged ‘installation’

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.