Ubuntu:Feisty/Servers

From

Jump to: navigation, search

Contents

Servers

Monitoring Server

If you want to monitor your Ubuntu servers and clients like memory usage,CPU usage,Load average,Disk usage,Mysql monitoring, Network Monitoring,Processes Monitoring this is for you

Print Server (cupsd)

How to install cupsd

Cupsd should be automatically installed during standard installation. Checkout if there is a file "/etc/init.d/cupsys". If you want to manually install it, do
 sudo apt-get install cupsys*

How to add a printer

  • Go to System -> Administration -> Printing.
  • Choose "Add printer".
  • "Add printer wizard" should start and tell you what to do.

How to remove a printer

 sudo lpadmin -x printernamewhere 
printername is the name of the printer you want to remove

How to print on remote Ubuntu machine from another Ubuntu machine

  • Make sure your local printer is well configured.
  • Enable local printer sharing - System -> Administration -> Printing -> Global Settings menu -> Share printers
  • Server ip address: 192.168.0.1
  • Client ip address: 192.168.0.23
    • Server configuration
 sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.backup
 gksudo gedit /etc/cups/cupsd.conf
find the block
<Location />
  ...
  Allow localhost
  ...
</Location>
and add the following line into it.
 Allow 192.168.0.23
Restart cups.
 sudo /etc/init.d/cupsys restart
    • Client configuration
 sudo cp /etc/cups/client.conf /etc/cups/client.conf.backup
 gksudo gedit /etc/cups/client.conf
And add the following line into it.
 ServerName 192.168.0.1
Restart cups.
 sudo /etc/init.d/cupsys restart
Now try "lpq" and you should see something like
 vitek@lightfox:~$ lpq
 HPLJ6P is ready
 no entries

How to print on remote Ubuntu machine from a Windows machine


1.19.4.5

How to set up 4 port printer server

Setting up COMPUSA print server on Ubuntu

(1) go to System, Administration, Printing.

(2) Then Add a printer

(3) Network Printer and choose HP JetDirect

(4) Where it says Host you put in the IP Address of the Print server. You can find it with Smb4k

(5) Where it says Port you put 9100 for USB port 1. 9101 for USB port 2. 9102 for USB port 3. and 9103 for USB port 4.

(6) Then click on forward and install your printer

NFS Server

Installing NFS Server

sudo apt-get install nfs-kernel-server nfs-common portmap

Reconfigure Portmap to not bind to loopback interface:

sudo dpkg-reconfigure portmap 
sudo /etc/init.d/portmap restart

Define which folders to share (export):

sudoedit /etc/exports

Add share (export) definitions:

This will export path to all IP addresses between 192.168.1.1 and 192.168.1.254 with Read/Write access:

/path/to/shared/files 192.168.1.0/24(rw,no_root_squash,async)

This will export path to all IP addresses between 192.168.1.1 and 192.168.1.254 with Read Only access:

/path/to/shared/files 192.168.1.0/24(ro,async)

When finished, save changes and restart the NFS Server:

sudo /etc/init.d/nfs-kernel-server restart

Export your new configuration:

sudo exportfs -a

Installing NFS Client

sudo apt-get install portmap nfs-common
Mounting Manually
cd ~
mkdir temp
sudo mount 192.168.1.1:/path/to/shared/files temp

You may need to restart NFS services:

sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart
Mounting Automatically

Create mountpoint:

sudo mkdir /mnt/files

Edit configuration:

gksudo gedit /etc/fstab

Add something similar to below:

192.168.1.1:/path/to/shared/files /mnt/files nfs rsize=8192,wsize=8192,timeo=14,intr 0 0

Test new configuration:

sudo mount /mnt/files

Reboot to test automatic mounting.

Samba Server

How to install Samba Server for files/folders sharing service

sudo apt-get install samba smbfs
  • You must also open the ports for incoming/outgoing use by Samba in the IPTables (firewall). This can be done using the Firestarter GUI, for example. Read #Firewall

How to add/edit/delete network users

sudo smbpasswd -a system_username
gksudo gedit /etc/samba/smbusers
    • Insert the following line into the new file
system_username = "network username"
    • Save the edited file
  • To edit network user
sudo smbpasswd -a system_username
  • To delete network user
sudo smbpasswd -x system_username

How to share home folders with read only permission (Authentication=Yes)

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
  security = user
  username map = /etc/samba/smbusers
  • Uncomment the following lines:
;[homes]
;comment = Home Directories
;browseable = no
;valid users = %S
;writable = yes
sudo testparm
sudo /etc/init.d/samba restart

How to share home folders with read/write permissions (Authentication=Yes)

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
  security = user
  username map = /etc/samba/smbusers
  • Find this section
...
# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
  writable = no
...
  • Replace with the following lines
# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
  writable = yes
sudo testparm
sudo /etc/init.d/samba restart

How to share group folders with read only permission (Authentication=Yes)

sudo mkdir /home/group
sudo chmod 777 /home/group/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
 security = user
 username map = /etc/samba/smbusers
  • Append the following lines at the end of file
[Group]
  comment = Group Folder
  path = /home/group
  guest ok = yes
  read only = yes
  create mask = 0700
  directory mask = 0700
  force user = nobody
  force group = nogroup

sudo testparm
sudo /etc/init.d/samba restart

How to share group folders with read/write permissions (Authentication=Yes)

sudo mkdir /home/group
sudo chmod 777 /home/group/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
  security = user
  username map = /etc/samba/smbusers
  • Append the following lines at the end of file
[Group]
  comment = Group Folder
  path = /home/group
  guest ok = yes
  read only = no
  create mask = 0700
  directory mask = 0700
  force user = nobody
  force group = nogroup
sudo testparm
sudo /etc/init.d/samba restart

How to share public folders with read only permission (Authentication=Yes)

  • Read #General Notes
  • Read [[#How to install Samba Server for files/folders sharing service]
sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
  security = user 
  username map = /etc/samba/smbusers
  • Append the following lines at the end of file
[public]
  comment = Public Folder
  path = /home/public
  guest ok = yes
  read only = yes
  create mask = 0777
  directory mask = 0777
  force user = nobody
  force group = nogroup
sudo testparm
sudo /etc/init.d/samba restart

How to share public folders with read/write permissions (Authentication=Yes)

sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following lines
  security = user
  username map = /etc/samba/smbusers
  • Append the following lines at the end of file
[public]
  comment = Public Folder
  path = /home/public
  guest ok = yes
  read only = no
  create mask = 0777
  directory mask = 0777
  force user = nobody 
  force group = nogroup
sudo testparm
sudo /etc/init.d/samba restart

How to share public folders with read only permission (Authentication=No)

sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following line (make sure it does not begin with a semicolon)
  security = share
  • Append the following lines at the end of file
[public]
  comment = Public Folder
  path = /home/public
  guest ok = yes
  read only = yes
  create mask = 0777
  directory mask = 0777
  force user = nobody
  force group = nogroup
  • Save the edited file
sudo testparm
sudo /etc/init.d/samba restart

How to share public folders with read/write permissions (Authentication=No)

sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
  • Find this line
...
;  security = user
...
  • Replace with the following line (make sure it does not begin with a semicolon)
  security = share
  • Append the following lines at the end of file
[public]
  comment = Public Folder
  path = /home/public
  guest ok = yes
  read only = no
  create mask = 0777
  directory mask = 0777
  force user = nobody
  force group = nogroup

  • Save the edited file
sudo testparm
sudo /etc/init.d/samba restart

How to print on remote Ubuntu machine via samba

 sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
 gedit /etc/samba/smb.conf
Find the following lines
 ...
 # printing = cups
 # printcap name = cups
 ...
and uncomment them.
 printing = cups
 printcap name = cups
Restart cups server
 sudo /etc/init.d/cupsys restart
Now printers working on your Ubuntu machine should be acessible via samba.

Windows networking error: "The account is not authorized to log in from this station."

When accessing the Samba server from a locked down Windows computer, the following error may occur: "\\hostname\sharename is not accessible. You might not have permission to use this network resource. The account is not authorized to log in from this station."

This is sometimes caused by the Windows computer requiring digitally signed communications. The local Global Security Policy on the Windows computer needs to be changed. The following policies need to be disabled under Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options:</p>

Samba Web Administration Tool (SWAT)

How to install INETD Superserver
 sudo apt-get install netkit-inetd
How to install SWAT for Samba daemon
 sudo apt-get install swat
  • Open inetd daemon configuration
 sudo gksu gedit /etc/inetd.conf
  • If string is:
 <#off#> swat            stream  tcp     nowait.400      root    /usr/sbin/tcpd  /usr/sbin/swat
  • Change to (due to know BUG which resets peer connection):
 swat            stream  tcp     nowait.400      root    /usr/sbin/swat  swat
  • Restart daemon
 sudo /etc/init.d/inetd restart


SSH Server

SSH stands for secure shell. It is a method for establishing encrypted communications over a data channel (a "tunnel") between a remote host and a local client. It is similar to, but simpler than, a VPN connection.

How to install SSH Server for remote administration service

sudo apt-get install ssh

How to SSH into remote Ubuntu host

  • In this example:
Remote Ubuntu machine: 192.168.0.2
username is a valid user on the remote host
ssh username@192.168.0.2
  • You can tunnel to a URL as well:
ssh username@foobar.dyndns.org

If your LAN uses a dynamic IP to connect to the Internet, you can use a Dynamic IP service (such as DynDNS) to assign a static URL to your LAN (foobar.dyndns.org, for example). An SSH request over the Internet to your URL (e.g. foobar.dyndns.org) would then be routed by the DynDNS service to your modem/router. Your router must then be set to forward the port used for the SSH tunnel to your host machine on the LAN. (SSH tunnels generally occur by default over port 22, but it can be changed (see below)).

  • You can explicitly select the port number (instead of port 22) for the SSH tunnel:
ssh username@foobar.dyndns.org:11022

However, if you do this, the host SSH server must be listening on the same port (port 11022 in the example). The port to listen to can be set in the ssdh_config file of the OpenSSH server (provided in Ubuntu) on your host. Also, your router must be configured to forward port 11022 to your OpenSSH host.

How to copy files/folders from remote Ubuntu host into local machine (scp)

  • In this example:
Remote Ubuntu machine: 192.168.0.2
Remote files/folders location: /home/username/remotefile.txt
Local machine save location: . (current directory)
scp -r username@192.168.0.2:/home/username/remotefile.txt

How to copy files/folders from local machine into remote Ubuntu host (scp)

  • In this example:
Local files/folders location: localfile.txt
Remote Ubuntu machine: 192.168.0.2
Remote Ubuntu machine save location: /home/username/
scp -r localfile.txt username@192.168.0.2:/home/username/

How to copy files/folders from remote Ubuntu host into local machine (rsync)

  • In this example:
Remote Ubuntu machine: 192.168.0.2
Remote files/folders location: /home/username/remotefile.txt
Local machine save location: . (current directory)
rsync -v -u -a --delete --rsh=ssh --stats username@192.168.0.2:/home/username/remotefile.txt

How to copy files/folders from local machine into a remote Ubuntu host (rsync)

  • For this example:
Local files/folders location: localfile.txt
Remote Ubuntu machine: 192.168.0.1
Remote Ubuntu machine save location: /home/username/
rsync -v -u -a --delete --rsh=ssh --stats localfile.txt username@192.168.0.1:/home/username/

How to mount remote host folders into local Ubuntu machine (sshfs)

  • For this example:
Remote machine: 192.168.0.2
Remote machine folder location: /media/music
  • Install sshfs
sudo apt-get install sshfs
  • Load kernel driver for sshfs
sudo modprobe fuse
  • Join the 'fuse' user group
sudo adduser your_user_name fuse
  • Logout and login for this to take effect.
  • fix group on /dev/fuse
 sudo chgrp fuse /dev/fuse
  • Create local mountpoint in your home directory
mkdir ~/remote_music
  • Mount the remote folder into ~/remote_music
sshfs 192.168.0.2:/media/music ~/remote_music

How to SSH into a remote Ubuntu host from a Windows client

How to copy files/folders from/into a host Ubuntu machine from a Windows client

How to limit the user accounts that can connect through ssh remotely

Using SSH to Port Forward

ssh -L <local port>:<remote computer>:<remote port> <user>@<remote ip>

An example is:

ssh -L 6669:94.92.10.15:6667 foowho

In this example, local port 6669 on the local client computer is tunneled by encrypted SSH over the default port 22 to the router at 94.92.10.15. The router must be set up to forward port 22 to whatever the internal LAN IP (such as 192.168.0.56) of the SSH host is. The host is running OpenSSH (ssdh service) and is set to listen to port 22. It then routes the incoming data to the host port 6667, where presumably some other program is waiting for data. foowho has an account on the host running the OpenSSH server.

SSH tunnels can also be established using URLs and even alternate ports. An example is:

ssh -L 5900:foobar.dyndns.org:5900 foowho -p 11022

In this example, local port 5900 on the client is forwarded through an SSH tunnel on port 11022 to foobar.dyndns.org. The DNS service translates foobar.dyndns.org into the appropriate WAN (Internet) IP address, where the router is listening. The router is set up to forward port 11022 to the LAN machine hosting the OpenSSH server, which is listening on port 11022. It then sends the data to whatever program is running on port 5900 on the host.

  • You can forward a local port to a different port on the remote host.
Example: Make port 80 (web server/browser) on the remote host at 10.0.2.10 available locally as port 81
ssh -L 81:10.0.2.10:80 user@office.net
  • You can create secure SSH tunnels to multiple hosts using multiple ports.
ssh -L 81:10.0.2.10:80 -L 82:10.0.2.20:80 -L 83:10.0.2.30:80 user@office.net

Now, local port 81 locally forwards to port 80 on the host at 10.0.2.10, local port 82 forwards to port 80 on the host at 10.0.2.20 and local port 83 forwards to port 80 on the host at 10.0.2.30. In this example, user has an account on all three host machines at 10.0.2.10, 10.0.2.20, and 10.0.2.30.

  • Once port forwarding is set up by ssh, an application is directed to the SSH tunnel for port usage by using the loopback as the destination.
Example 1:
ssh -L 81:10.0.2.10:80 user@office.net
http://localhost:81 or http://127.0.0.1/:81

will direct a web browser to use port 81 locally, which is being redirected by SSH to port 80 on the remote host at 10.0.2.10.

Example 2:
ssh -L 5900:foobar.dyndns.org:5900 foowho
vncviewer 127.0.0.1 or vncviewer localhost

will direct vncviewer (which uses port 5900 by default) to direct its traffic through the ssh tunnel to the host at foobar.dyndns.org, where, presumably, a VNC server is listening on port 5900.

Protecting SSH from brute force attack

It is possible to easily protect SSH from a password brute force attack with a pam_abl module. You can install it by the two ways:

To install from a repository:

And execute the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libpam-abl
sudo /etc/init.d/ssh restart

First command is to fetch the repository listing. Second is to upgrade the openssh-server package to patched version (openssh-client will be also updated). Third is to set up a protection plugin. And the fourth is to restart a server with a new security plugin.

Rsync Daemon

Rsync is a backup/mirroring/synchronization tool to keep two directories, local or remote, synchronized. Read this brief tutorial.

How to install the Rsync Daemon for remote backup and restoration of files

Usually by default Ubuntu will have rsync installed but not enabled. But to make sure run this command:

 sudo apt-get install rsync

Now we need to create the configuration file. This tells the daemon what to do:

 sudo gedit /etc/rsyncd.conf

Copy and paste the following into the file but make sure to replace all instances of "username" with your username:

 [usernamebackup]
 
     path = /home/username/backup
     comment = Backup
     uid = username
     gid = username
     read only = false
     auth users = username
     secrets file = /etc/rsyncd.secrets

Set the permission on the file to be safe:

 sudo chmod 644 /etc/rsyncd.conf

Create a username and password file:

 sudo gedit /etc/rsyncd.secrets

And enter in your credentials:

 username:password

Make the file secure, we don't want the password's stolen:

 sudo chmod 600 /etc/rsyncd.secrets

Now the rsync daemon is not enabled by default, so go edit /etc/default/rsync:

 sudo gedit /etc/default/rsync

And set:

 RSYNC_ENABLE=false

To:

 RSYNC_ENABLE=true

This allows the daemon to become active and lets you back up your data! To kickstart the change, restart the daemon:

 sudo /etc/init.d/rsync restart

Enable SSH Banner

After login you can have the contents of a "banner" file displayed on the user's screen.

  • Open up the sshd configuration file:
sudo gedit /etc/ssh/sshd_config
  • Find:
#Banner /etc/issue.net
  • Replace:
Banner /etc/issue.net
  • Edit the issue.net file to contain what you want displayed:
sudo gedit /etc/issue.net
  • Add what you want:
                        _     
  ___ _ _ ___ _____ ___| |___ 
 | -_|_'_| .'|     | . | | -_|
 |___|_,_|__,|_|_|_|  _|_|___|
                   |_|        
 Welcome to my server
  • Restart SSHD:
sudo /etc/init.d/ssh restart

DHCP Server

How to install DHCP Server for automatic IP addresses assignment

  • In this example:
"eth0" is the interface for network card
IP Address Range: 192.168.0.100 to 192.168.0.200
Subnet Mask: 255.255.255.0
DNS Servers: 202.188.0.133, 202.188.1.5
Domains: tm.net.my
Gateway Address: 192.168.0.1
sudo apt-get install dhcp3-server
sudo cp /etc/default/dhcp3-server /etc/default/dhcp3-server_backup
gksudo gedit /etc/default/dhcp3-server
  • Find this line:
...
INTERFACES=""
  • Replace with the following line:
INTERFACES="eth0"
  • Save the edited file
sudo cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf_backup
gksudo gedit /etc/dhcp3/dhcpd.conf
  • Find this section:
...
# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
...
  • Replace with the following lines:
# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;
  • Find this section:
...
# A slightly different configuration for an internal subnet.
#subnet 10.5.5.0 netmask 255.255.255.224 {
# range 10.5.5.26 10.5.5.30;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org";
# option routers 10.5.5.1;
# option broadcast-address 10.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}
...
  • Replace with the following lines:
# A slightly different configuration for an internal subnet.
subnet 192.168.0.0 netmask 255.255.255.0 {
 range 192.168.0.100 192.168.0.200;
 option domain-name-servers 202.188.0.133, 202.188.1.5;
 option domain-name "tm.net.my";
 option routers 192.168.0.1;
 option broadcast-address 192.168.0.255;
 default-lease-time 600;
 max-lease-time 7200;
}
  • Restart the DHCP server:
sudo /etc/init.d/dhcp3-server restart

Backup Ubuntu System

If you want to backup your ubuntu system try one of the following backup tools

Sbackup

Dar and Kdar

Ubuntu Feisty LAMP Server

LAMP stands for Linux, Apache, MySQL, and PHP. These components together comprise the easiest and most widely used web server.

  • Feisty has made a LAMP server installation a one-click process. If you are installing from an Ubuntu Server disk, you will be given the option of installing a LAMP server during initial installation. No other steps are required.
  • If you have not installed a LAMP server during installation, it can be installed from Synaptic Package Manager as a package. No other steps are required.
System-->Administration-->Synaptic Package Manager-->Edit-->Mark packages by Task-->LAMP Server-->OK

How to further setup your LAMP server by creating and using MySQL databases, etc, go here.

  • From the command line, the LAMP server package can be installed using:
sudo tasksel install lamp-server

or

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

Database Server

How to install MYSQL Database Server

sudo apt-get install mysql-server
  • MySQL initially only allows connections from the localhost (127.0.0.1). We'll need to remove that restriction if you wish to make it accessible to everyone on the internet. Open the file /etc/mysql/my.cnf
gksudo gedit /etc/mysql/my.cnf
  • Find the line bind-address = 127.0.0.1 and comment it out
...
#bind-address           = 127.0.0.1
...
  • MySQL comes with no root password as default. This is a huge security risk. You'll need to set one. So that the local computer gets root access as well, you'll need to set a password for that too. The local-machine-name is the name of the computer you're working on. For more information see here
mysqladmin -u root password your-new-password
mysqladmin -h local-machine-name -u root -p password your-new-password
sudo /etc/init.d/mysql restart
  • Validate the existence of the socket file
find /var/run/mysqld -name *.sock

If it does not exist then create it.

touch /var/run/mysqld/mysqld.sock

MySQL Database backup using AutoMySQLBackup

  • AutoMySQLBackup is a script to take daily, weekly and monthly backups of your MySQL databases using mysqldump.
  • AutoMySQLBackup Script Features
    • Backup mutiple MySQL databases with one script. (Now able to backup ALL databases on a server easily. no longer need to specify each database seperately)
    • Backup all databases to a single backup file or to a seperate directory and file for each database.
    • Automatically compress the backup files to save disk space using either gzip or bzip2 compression.
    • Can backup remote MySQL servers to a central server.
    • Runs automatically using cron or can be run manually.
    • Can e-mail the backup log to any specified e-mail address instead of “root”. (Great for hosted websites and databases).
    • Can email the compressed database backup files to the specified email address.
    • Can specify maximun size backup to email.
    • Can be set to run PRE and POST backup commands.
    • Choose which day of the week to run weekly backups.
  • AutoMySQLBackup Requirements

The AutoMySQLBackup script only requires mysqldump (A standard utility provided with the mysql client) and gzip or bzip2 for compression of the backup files. If you would like to have the log emailed to you then you will need to have permission to execute the “mail” program. If you want the compressed backup files mailed to you then Mutt must be available on the server. Finally you will need a bash shell and the standard system tools and utilities (all these requirements should be the default on most linux system.)

  • What AutoMySQLBackup does

Every day AutoMySQLBackup will run (if setup in /etc/cron.daily) and using mysqldump and gzip will dump your specified databases to the /backups/daily directory, it will rotate daily backups weekly so you should never have more than 7 backups in there..

Every Saturday AutoMySQLBackup will again backup the databases you have chosen but they will be placed into /backups/weekly, these will be rotated every 5 weeks so there should never be more than 5 backups in there..

Every 1st of the month AutoMySQLBackup will create a backup of all databases and place them into /backups/monthly. These will never be rotated so it will be up to you to do your own house keeping. I would suggest taking a copy of this offline every month or two so that if you have a hard drive failure you will be able to restore your database

  • AutoMySQLBackup Installation

The install is as simple as editing a few variables in the AutoMySQLBackup file. The full setup is documented in the AutoMySQLBackup script file below the variables section.

  • Download automysqlbackup.sh and place it into your /etc/cron.daily directory or your home directory.
  • Edit (at least) the following lines :
...
USERNAME=dbuser 
PASSWORD=password DBNAMES=”DB1 DB2 DB3″
...
  • Note:The user must have at least select privileges to the databases and make sure to keep the quotes ” ” otherwise it won’t work
  • Make the file executable :
sudo chmod u+rwx
  • Create the following directory
./backups
  • That’s it...Now you can run it using the command line “./automysqlbackup.sh” or if it is in /etc/cron.daily it will run each day when cron

How to install MYSQL Administrator

sudo apt-get install mysql-admin

How to install MySQL Query Browser (SQL Client)

sudo apt-get install mysql-query-browser

How to install Oracle Database XE

  • Add the following repository to your /etc/apt/sources.list:
deb http://oss.oracle.com/debian unstable main non-free
  • Get the public key
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add - 
  • Install the software using apt-get
sudo apt-get update
sudo apt-get install oracle-xe
  • Add your login to the 'dba' group (where your login name is username)
sudo usermod -G dba -a username
  • Run the initial configuration
sudo /etc/init.d/oracle-xe configure

You can configure any ports you want as long as they don't interfere with any other services listening on ports. You can choose the defaults by pressing enter instead of entering something in.

Apache HTTP Server

How to install Apache HTTP Server for HTTP (Web) Server service

  • Install:
sudo apt-get install apache2
  • Access:
http://localhost

Depending on how you setup apache, you may need to run a command to map public_html directories (inside user home directories) to ~. like, http://localhost/~chris. The optional command is:

sudo a2enmod userdir

How to install PHP for Apache HTTP Server

  • Note: PHP can be installed separately or as part of a LAMP integrated server package (Linux, Apache2, MySql, PHP). To install the integrated package, read #Ubuntu Feisty LAMP Server.
How to install PHP5
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
  • To test if php5 installed correctly
gksudo gedit /var/www/testphp.php
  • (Optional) Insert the following line into the new file
<?php phpinfo(); ?>

If that didn't work (for example, if your browser prompted you to save the testphp.php page), try these commands:

sudo a2enmod php5
sudo /etc/init.d/apache2 force-reload

Then try opening http://localhost/testphp.php again

Installing recommended modules
sudo apt-get install php-pear php5-gd php5-xsl curl libcurl3 libcurl3-dev php5-curl

(Optional) The ability to use the mail() function is also recommended. You need a package that enables you to use the sendmail command and Postfix is a good one. If you do not want to install this, then go to the Restart Apache step and you're finished.

sudo apt-get install postfix

After running that, you will be prompted to configure postfix.

  • Restart Apache
sudo /etc/init.d/apache2 restart

Many PHP applications use XSLT technology as well as server-side graphic manipulation (via GD). Also, PEAR provides access to PHP's module repository. cURL is a way to simulate a user's actions at a web browser. One can use it to get content off a website such as to create dynamic statistics.

How to install MYSQL for Apache HTTP Server

sudo apt-get install libapache2-mod-auth-mysql
  • Select either php4-mysql or php5-mysql depending on which version of PHP you installed
sudo apt-get install php<version-number>-mysql
sudo apt-get install phpmyadmin
  • If you installed phpmyadmin using apt-get and cannot log in, run sudo apt-get purge phpmyadmin and then sudo apt-get install phpmyadmin.
  • To get PHP to work with MySQL, open the file (where <version> is either 4 or 5 depending on which PHP you installed)
sudo gedit /etc/php<version>/apache2/php.ini
  • You'll need to uncomment the ";extension=mysql.so" line so that it looks like this
...
extension=mysql.so
...
  • Save the file then exit
sudo /etc/init.d/apache2 restart
  • If you cannot log in, set a password:
 sudo mysqladmin password <NEWPASSWORD>

Alternative if the above doesn't work (which it probably won't and this probably will):

 sudo apt-get install mysql-server

How to install Python for Apache 2

sudo apt-get install python
sudo apt-get install libapache2-mod-python
sudo gedit /etc/apache2/mods-available/mod_python.conf

add the following lines

AddType application/x-httpd-python .py
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

save

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/mod_python.conf mod_python.conf
sudo /etc/init.d/apache2 restart

How to map URLs to folders outside /var/www/

gksudo gedit /etc/apache2/conf.d/alias
  • Insert the following lines into the new file
Alias /URL-path /location_of_folder/
<Directory /location_of_folder/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>
  • Save the edited file
sudo /etc/init.d/apache2 restart
  • When you get "403 - Permission denied", you might try:
chmod o+x /location_of_folder/
  • If that doens't work, the following might help:
chmod o+r,o+x /location_of_folder/

How to change the default port number for Apache HTTP Server

  • For this example:
The new port number will be 78
sudo cp /etc/apache2/ports.conf /etc/apache2/ports.conf_backup
gksudo gedit /etc/apache2/ports.conf
  • Find this line:
Listen 80
  • Replace with the following line:
Listen 78
  • Restart Apache:
sudo /etc/init.d/apache2 restart
  • Check to see if you can access the Apache web site on the new port:
http://localhost:78

How to parse RSS into PHP for Apache HTTP Server

  • For this example:
RSS is DistroWatch.com - News
wget -c http://easylinux.info/uploads/magpierss-0.71.1.tar.gz
sudo mkdir /var/www/feeds
sudo tar zxvf magpierss-0.71.1.tar.gz -C /var/www/feeds/
sudo mv /var/www/feeds/magpierss-0.71.1/* /var/www/feeds/
sudo rm -fr /var/www/feeds/magpierss-0.71.1/
sudo chown -R www-data:root /var/www/feeds/
gksudo gedit /var/www/feeds/index.php
  • Insert the following lines into the new file:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 
 <head>
 
 <title>DistroWatch.com - News</title>
 
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
 
 <style type="text/css">
 /*<![CDATA[*/
 /* 
 DEFAULT TAG STYLES
 */
 
 body {
  background: #ffffff;
  margin-left: 20px;
  font-family: bitstream vera sans,sans-serif;
  font-size: 9pt;
 }
 
 h1 {
  font-family: luxi sans,sans-serif;
  font-size: 15pt;
 }
 
 /*]]>*/
 </style>
 
 </head>
  
 <body>
 
 <?php

 require_once 'rss_fetch.inc';
 error_reporting(E_ERROR);
 
 $url = 'http://distrowatch.com/news/dw.xml';
 $rss = fetch_rss($url);
 
 if ($rss) {
 
  echo "<h1>";
  echo "<a href=$url>", $rss->channel[title], "</a><br/>";
  echo "</h1>";
 
  foreach ($rss->items as $item ) {
   $url = $item[link];
   $title = $item[title];
   $description = $item[description];
   echo "<li>";
   echo "<b>Topic:</b> <a href=$url><b><u>$title</u></b></a><br/><br/>";
   echo "$description<br/><br/>";
   echo "</li>";
  }
 
 }
 else {
  echo "<a href=$url>", $url, "</a> - Server Down!<br/>";
 }
 
 ?>
 
 </body>
 
 </html>
 
  • Check your feeds:
http://localhost/feeds/index.php

FTP Server

How to install FTP Server for File Transfer service

sudo apt-get install proftpd

How to configure FTP user to be "jailed" (chrooted) into their home directory

sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf_backup
gksudo gedit /etc/proftpd/proftpd.conf
  • Find this section
...
DenyFilter           \*.*/
...
  • Add the following line below it
DefaultRoot           ~

  • Save the edited file
sudo /etc/init.d/proftpd restart

How to configure FTP Server to allow anonymous FTP user to read only

sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf_backup
gksudo gedit /etc/proftpd/proftpd.conf
  • Append the following lines at the end of file
<Anonymous ~ftp>
 User            ftp
 Group            nogroup
 UserAlias          anonymous ftp
 DirFakeUser on ftp
 DirFakeGroup on ftp
 RequireValidShell      off
 MaxClients         10
 DisplayLogin        welcome.msg
 DisplayFirstChdir      .message
 <Directory *>
  <Limit WRITE>
   DenyAll
  </Limit>
 </Directory>
</Anonymous>
  • Save the edited file
sudo /etc/init.d/proftpd restart

How to configure FTP Server to allow anonymous FTP user to read/write

sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf_backup
gksudo gedit /etc/proftpd/proftpd.conf
  • Append the following lines at the end of file
<Anonymous ~ftp>
 User            ftp
 Group            nogroup
 UserAlias          anonymous ftp
 DirFakeUser on ftp
 DirFakeGroup on ftp
 RequireValidShell      off
 MaxClients         10
 DisplayLogin        welcome.msg
 DisplayFirstChdir      .message
</Anonymous>
  • Save the edited file
sudo /etc/init.d/proftpd restart

How to map anonymous FTP user to folders outside /home/ftp/

sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf_backup
gksudo gedit /etc/proftpd/proftpd.conf
  • Append the following lines at the end of file
<Anonymous /location_of_folder/>
 User            ftp
 Group            nogroup
 UserAlias          anonymous ftp
 DirFakeUser on ftp
 DirFakeGroup on ftp
 RequireValidShell      off
 MaxClients         10
 DisplayLogin        welcome.msg
 DisplayFirstChdir      .message
 <Directory *>
  <Limit WRITE>
   DenyAll
  </Limit>
 </Directory>
</Anonymous>
  • Save the edited file
sudo /etc/init.d/proftpd restart

How to change the default port number for FTP Server

  • For this example:
The new port number will be 77
sudo cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf_backup
gksudo gedit /etc/proftpd/proftpd.conf
  • Find this line:
Port              21
  • Replace with the following line:
Port              77
  • Restart the FTP server:
sudo /etc/init.d/proftpd restart

How to ftp into remote Ubuntu host from a Windows client machine

  • Download and install FileZilla for Windows: Here
  • FTP addresses take the form:
ftp://[username]:[password]@[hostname].[domain].[tld]:[portnumber]/[directory]/

Note: the username and password are optional. If they are not given and the server is not configured for anonymous access, then they will be requested.

How to FTP to a remote Windows host from an Ubuntu client machine

  • Install an FTP client on your local client machine. Again, you can use FileZilla or CrossFTP.
apt-get install filezilla
  • The FTP address normally has the form:
ftp://[username]:[password]@[hostname]:[port]

How to configure your NAT/router/gateway/firewall for FTP server

  • Configure your FTP server with a limited passive port range so that TCP range can be opened in the incoming firewall.
  • For proftpd, edit /etc/proftpd/proftpd.conf:
gksudo gedit /etc/proftpd/proftpd.conf
and edit this line with the desire port range to use for FTP transfers:
PassivePorts xx-yy
Port x
where x is the port over which you wish FTP traffic to be directed.
  • The NAT/router/gateway/firewall devices or software must be configured to allow the configured incoming TCP ports (port x in the example) to be forwarded to your host on the LAN.

Personal Apt Repository

Setting Up Repository

Note: This type of repository is known as a Trivial Repository.

This type of repository does not fully comply with Debian standards, so should not be used commercially. However, it is ideal for home or personal use.

  • Install Package Tools
sudo apt-get install dpkg-dev
  • Create Repos on Filesystem
mkdir /somewhere/apt
mkdir /somewhere/apt/archives
mkdir /somewhere/apt/archives/binary
  • (Optional) Copy existing local APT cache to your Repos
cp -v /var/cache/apt/archives/*.deb /somewhere/apt/archives/binary/
  • Create Package Lists for Repos
cd /somewhere/apt/archives
dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz
  • Publish Repos with Apache
cd /var/www
sudo ln -s /somewhere/apt/archives apt
  • Add Repos to Sources (on all PCs) to /etc/apt/sources.list

Open /etc/apt/sources.list

sudo gedit /etc/apt/sources.list

Add the following to the bottom of the file:

# My Repos
deb http://localhost/apt binary/
  • Update APT Database
sudo apt-get update

Updating Repository

Simply copy or download ".deb" files to /somewhere/apt/archives/binary/ and then update the Packages list:

cd /somewhere/apt/archives
dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz

Streaming Media Server

How to install GNUMP3d for Streaming Media Server service

e.g. /var/music/ is the directory containing multimedia files
sudo apt-get install gnump3d

How to change the default directory containing multimedia files for GNUMP3d

  • In this example:
The new directory containing multimedia files is /home/music/
sudo cp /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d.conf_backup
gksudo gedit /etc/gnump3d/gnump3d.conf
  • Find this line:
root = /var/music
  • Replace with the following line:
root = /home/music
  • Find this line:
user = gnump3d
  • Replace with the following line:
user = root
  • Restart the Gnump3 server.
sudo /etc/init.d/gnump3d restart
  • Verify the service is running:
http://localhost:8888

How to change the default port number for GNUMP3d

e.g. Assumed that new port number is 7878
sudo cp /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d.conf_backup
gksudo gedit /etc/gnump3d/gnump3d.conf
  • Find this line
port = 8888
  • Replace with the following line
port = 7878
  • Save the edited file
sudo /etc/init.d/gnump3d restart

How to enable downmixing support (for streaming outside your LAN)

sudo cp /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d.conf_backup
gksudo gedit /etc/gnump3d/gnump3d.conf
  • Find this line
# downsample_enabled = 1
  • Uncomment the line (remove the '#' hash symbol) so it looks like this
downsample_enabled = 1
  • Then find these lines
# downsample_clients = ALL
# no_downsample_clients = 192.168.0.0/24
  • Replace them with these lines
downsample_clients = ALL 
no_downsample_clients = 192.168.0.0/24
no_downsample_clients = 10.0.0.0/24
no_downsample_clients = 172.16.0.0/12
  • Finally, find these lines
#downsample_high_mp3   = /usr/bin/lame  --mp3input -b 56 $FILENAME -
#downsample_medium_mp3 = /usr/bin/lame  --mp3input -b 32 $FILENAME -
#downsample_low_mp3    = /usr/bin/lame  --mp3input -b 16 $FILENAME -
#
#downsample_high_ogg   = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 96 -
#downsample_medium_ogg = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 64 -
#downsample_low_ogg    = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix --resample 22050 -b 32 -
  • And uncomment them as well (remove all the '#' hash symbols) so they look like this
downsample_high_mp3   = /usr/bin/lame  --mp3input -b 56 $FILENAME -
downsample_medium_mp3 = /usr/bin/lame  --mp3input -b 32 $FILENAME -
downsample_low_mp3    = /usr/bin/lame  --mp3input -b 16 $FILENAME -

downsample_high_ogg   = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 96 -
downsample_medium_ogg = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 64 -
downsample_low_ogg    = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix --resample 22050 -b 32 -
  • Save the edited file
sudo /etc/init.d/gnump3d restart

How to downmix MP3 to Ogg Vorbis (better quality)

sudo cp /etc/gnump3d/gnump3d.conf /etc/gnump3d/gnump3d.conf_backup
gksudo gedit /etc/gnump3d/gnump3d.conf
  • Find these lines
downsample_high_mp3   = /usr/bin/lame  --mp3input -b 56 $FILENAME -
downsample_medium_mp3 = /usr/bin/lame  --mp3input -b 32 $FILENAME -
downsample_low_mp3    = /usr/bin/lame  --mp3input -b 16 $FILENAME -
  • Replace them with these lines
downsample_high_mp3   = /usr/bin/madplay $FILENAME -o raw:- | oggenc --raw --downmix -b 96 -
downsample_medium_mp3 = /usr/bin/madplay $FILENAME -o raw:- | oggenc --raw --downmix -b 64 -
downsample_low_mp3    = /usr/bin/madplay $FILENAME -o raw:- | oggenc --raw --downmix --resample 22050 -b 32 -
  • Save the edited file
sudo /etc/init.d/gnump3d restart

How to add downmixing support for FLAC audio

sudo apt-get install flac
  • Find the following lines
downsample_high_ogg   = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 96 -
downsample_medium_ogg = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 64 -
downsample_low_ogg    = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix --resample 22050 -b 32 -
  • Just under those, add the following lines
downsample_high_flac 	= /usr/bin/oggenc --downmix -b 96 $FILENAME -o -
downsample_medium_flac 	= /usr/bin/oggenc --downmix -b 64 $FILENAME -o -
downsample_low_flac 	= /usr/bin/oggenc --downmix --resample 22050 -b 32 $FILENAME -o -
  • Save the edited file
sudo /etc/init.d/gnump3d restart

How to add downmixing support for AAC/MPEG-4 audio

sudo apt-get install faad
  • Find the following lines
downsample_high_ogg   = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 96 -
downsample_medium_ogg = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix -b 64 -
downsample_low_ogg    = /usr/bin/sox -t ogg $FILENAME -t raw - | oggenc --raw --downmix --resample 22050 -b 32 -
  • Just under those, add the following lines
downsample_high_m4a 	= /usr/bin/faad $FILENAME -d -o - | oggenc --raw --downmix -b 96 - -o -
downsample_medium_m4a	= /usr/bin/faad $FILENAME -d -o - | oggenc --raw --downmix -b 64 - -o -
downsample_low_m4a	= /usr/bin/faad $FILENAME -d -o - | oggenc --raw --downmix -b --resample 22050 -b 32 - -o -
  • Save the edited file
sudo /etc/init.d/gnump3d restart

Groupware (Email/Calendaring)

How to install Meldware Communication Suite

  • Read #General Notes
  • Read #How_to_install_Java_Development_Kit_.28JDK.29_v5.0
  • Meldware Communication Suite provides a multi-platform alternative to popular groupware like Exchange or Lotus Notes including Email(SMTP/POP/IMAP) and Calendaring(iCAL,WCAP). It depends on Java and, optionally, for the webmail/webcal client, Flash.
sudo apt-get install sun-java5-jdk
sudo update-java-alternatives -s java-1.5.0-sun
  • Download the jar file for a recent milestone or build here
  • Open a new terminal (capture java path updates)
  • change directory to your download directory
  • replace below filename with correct version based on your download
sudo java -jar buni-meldware-20070225.jar
  • A series of configuration questions are asked, for destination directory specify /opt/mcs
sudo cp /etc/init.d/skeleton /etc/init.d/meldware-cs
gksudo gedit /etc/init.d/meldware-cs
  • Replace the value in the line beginning with PATH with "/usr/sbin:/usr/bin:/sbin:/bin:/opt/mcs/bin" excluding quotes (assuming you specified /opt/mcs as the destination directory to the installer)
  • Replace the value in the line beginning with DESC with "Meldware Communication Suite" including quotes
  • Replace the value in the line beginning with NAME with "run.sh" excluding quotes
  • Replace the value in the line beginning with DAEMON with "/opt/mcs/bin/$NAME" excluding quotes
  • Replace the value in the line beginning with DAEMON_ARGS with "-c meldware" excluding quotes
  • Replace the value in the line beginning with SCRIPTNAME with "/etc/init.d/meldware-cs" excluding quotes
  • save (ESC):wq
sudo chmod 755 /etc/init.d/meldware-cs
sudo ln -s /etc/init.d/meldware-cs /etc/rc3.d/S21meldware-cs
sudo ln -s /etc/init.d/meldware-cs /etc/rc6.d/K21meldware-cs
sudo ln -s /etc/init.d/meldware-cs /etc/rc4.d/S21meldware-cs 
  • start MCS
sudo /etc/init.d/meldware-cs restart
  • Additional documentation is available here

Image Gallery Server

  • For a comparison between Gallery1 and Gallery2 see here

Gallery1

How to install Gallery1 for Image Gallery Server service
sudo apt-get install gallery (when prompted to restart Apache, choose No or Cancel)
sudo apt-get install imagemagick
sudo apt-get install jhead
sudo apt-get install libjpeg-progs
sudo /etc/init.d/apache2 restart
sudo sh /usr/share/gallery/configure.sh
Gallery Configuration Wizard: Step 1
Next Step ->
Gallery Configuration Wizard: Step 2
General settings Tab ->
Admin password: Specify the password

Locations and URLs Tab ->
Album directory: /var/www/albums/
Temporary directory: /tmp/
Gallery URL: http://localhost/gallery
Albums URL: http://localhost/albums
Next Step -->
Gallery Configuration Wizard: Step 3
Next Step -->
Gallery Configuration Wizard: Step 4
Save Config ->
How to configure Gallery1 to be accessible via Internet (Hostname or fix IP) or LAN (fix IP)
  • In this example:
The host's Internet URL is http://www.url.com
sudo cp /etc/gallery/config.php /etc/gallery/config.php_backup
gksudo gedit /etc/gallery/config.php
  • Find this section:
...
$gallery->app->photoAlbumURL = "http://localhost/gallery";
$gallery->app->albumDirURL = "http://localhost/albums";
...
  • Replace with the following lines:
$gallery->app->photoAlbumURL = "http://www.url.com/gallery";
$gallery->app->albumDirURL = "http://www.url.com/albums";
  • Verify the gallery is accessible:
http://www.url.com/gallery/albums.php
How to configure Gallery1 to be accessible via LAN (dynamic IP)
  • For this example:
the host running Gallery 1 is located on the LAN at (dynamic IP): 192.168.0.2
sudo cp /etc/gallery/config.php /etc/gallery/config.php_backup
gksudo gedit /etc/gallery/config.php
  • Find this section
...
$gallery->app->photoAlbumURL = "http://localhost/gallery";
$gallery->app->albumDirURL = "http://localhost/albums";
...
  • Replace with the following lines
$gallery->app->photoAlbumURL = "/gallery";
$gallery->app->albumDirURL = "/albums";
  • Look for the gallery:
http://192.168.0.2/gallery/albums.php
How to backup/restore Gallery1 data
sudo tar zcvf gallery.tgz /var/www/albums/ /etc/gallery/
  • To restore Gallery data
sudo tar zxvf gallery.tgz -C /

Gallery2

How to install Gallery2
How to configure Gallery2

How to install Subversion version control server (with Apache support)

  • Install Subversion and Apache 2 Module
sudo apt-get install subversion apache2 libapache2-svn
  • Enable Subversion/DAV Apache 2 Module
sudo a2enmod dav_svn
  • Configure Apache 2
sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Edit the file to look something like this:

<Location /svn>
  DAV svn
  SVNPath /home/svn

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  Require valid-user
</Location>
  • Create Subversion Repository
sudo mkdir /home/svn
sudo svnadmin create /home/svn
  • Give Apache 2 Permissions to Repository
sudo chown -R www-data /home/svn
  • Create Repository User

Replace 'username' with your username

sudo htpasswd -cm /etc/apache2/dav_svn.passwd username

Enter password when prompted.

  • Restart Apache 2
sudo /etc/init.d/apache2 restart
  • Working with the new repository

Open a terminal window and paste:

svn checkout http://username@localhost/svn lucky

You will be prompted to enter the password. Now you have a working copy in the directory 'lucky'. Now lets create a file and commit it.

cd lucky
mousepad Hello.txt

Enter anything you like in the file and click save, Exit.

svn add Hello.txt

Now you added the file but it won't appear in the repository yet, you have to commit it. To commit, its as easy as doing the following:

svn commit

Now check your repository using the web browser at http://localhost/svn/.

How to install Subversion version control server (svnserve)

  • Install Subversion and Internet services daemon
sudo apt-get install subversion xinetd
  • Create user that will own the repositories
sudo adduser --system --no-create-home --home /var/svn --group --disabled-login svn
  • Create directory that will hold the repositories
sudo mkdir /var/svn
sudo chown -R svn:svn /var/svn
  • Create file /etc/xinetd.d/svnserve with the following content
service svn
{
       port = 3690
       socket_type = stream
       protocol = tcp
       wait = no
       user = svn
       server = /usr/bin/svnserve
       server_args = -i -r /var/svn
}
  • Restart xinetd
sudo /etc/init.d/xinetd restart
  • Create the first repository
sudo -u svn svnadmin create /var/svn/testrepo
  • It should be possible to check out the repository and work on it
svn co svn://localhost/testrepo

PhpGedView Server

PhpGedView allows you to view and edit your genealogy (family tree) on your website.

How to install PhpGedView Server

sudo apt-get install phpgedview

How to configure PhpGedView with MySQL

gksudo gedit /etc/phpgedview/config.php

Edit /etc/phpgedview/config.php to reflect the following changes.

$DBTYPE = "mysql";
$DBHOST = "localhost";
$DBUSER = "phpgedview_my_family";
$DBPASS = "password_for_dbuser";
$DBNAME = "phpgedview_my_family";

I made $DBUSER the same as $DBNAME because it is easier to create user and database privileges using phpMyAdmin.

http://localhost/phpmyadmin

Log into phpMyAdmin as root with no password if you have not changed the root password for MySQL yet.

Click on "Privileges" (fourth from the bottom in the middle column).

Click "Add a new User".

Login Information
  User name: [Use text field:] phpgedview_my_family (same as $DBUSER above)
  Host: [Local] localhost
  Password: [Use text field:] password_for_dbuser (same as $DBPASS above)
  Re-type: password_for_dbuser (same as $DBPASS above)
Database for user
  [x] Create database with same name and grant all privileges

Click "Go".

MySQL should now have your new PhpGedView user and database. Go back to phpMyAdmin's home page and "Reload privileges".

Add PhpGedView to Apache.

sudo ln -s /etc/phpgedview/apache.conf /etc/apache2/sites-available/phpgedview
sudo a2ensite phpgedview #equivalent to 'ln -s /etc/apache2/sites-available/phpgedview phpgedview'
sudo /etc/init.d/apache2 restart
gksudo gedit /etc/phpgedview/config_gedcom.php

Optionally edit /etc/phpgedview/config_gedcom.php to reflect the following changes.

$CONTACT_EMAIL = "you@yourdomain.com";
$WEBMASTER_EMAIL = "webmaster@yourdomain.com";
$HOME_SITE_URL = "http://localhost/phpgedview";
$HOME_SITE_TEXT = "My Family PhpGedVIew";

Create the initial administrator account for your new PhpGedView server.

http://localhost/phpgedview

Continue creating users, uploading your existing GEDCOM file, or start creating your family tree.

http://wiki.phpgedview.net/en/index.php/Installation_Guide
Personal tools
Sponsor
     Asus X200CA