Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Thursday, May 26, 2011

VBoxHeadless - Running Virtual Machines With VirtualBox 4.0 On A Headless Ubuntu 11.04 Server

This guide explains how you can run virtual machines with VirtualBox 4.0 on a headless Ubuntu 11.04 server. Normally you use the VirtualBox GUI to manage your virtual machines, but a server does not have a desktop environment. Fortunately, VirtualBox comes with a tool called VBoxHeadless that allows you to connect to the virtual machines over a remote desktop connection, so there's no need for the VirtualBox GUI.


I do not issue any guarantee that this will work for you!


I have tested this on an Ubuntu 11.04 server (host system) with the IP address 192.168.0.100 where I'm logged in as a normal user (user name administrator in this example) instead of as root.


To install VirtualBox 4.0 on our Ubuntu 11.04 server, we open /etc/apt/sources.list...

sudo vi /etc/apt/sources.list


... and add the following line to it:

[...]deb http://download.virtualbox.org/virtualbox/debian natty contrib

Then we download the VirtualBox public key...

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -


... and update our package database:

sudo apt-get update


Afterwards, we install VirtualBox 4.0 as follows:

sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.0 dkms


(The dkms package ensures that the VirtualBox host kernel modules are properly updated if the Linux kernel version changes.)


Starting with version 4.0, VirtualBox has introduced so called "extension packs" and has outsourced some functionality like remote desktop connection support (VRDP) that was part of VirtualBox packages before version 4.0 into these extension packs. Because we need remote desktop connections to control our virtual machines, we need to install the appropriate extension pack now. Go to http://www.virtualbox.org/wiki/Downloads, and you will find a link to the following extension pack:

VirtualBox 4.0.6 Oracle VM VirtualBox Extension Pack
Support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards.


Download and install the extension pack as follows:

cd /tmp
wget http://download.virtualbox.org/virtualbox/4.0.6/Oracle_VM_VirtualBox_Extension_Pack-4.0.6-71344.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.6-71344.vbox-extpack


(Make sure you grab the latest version from the VirtualBox web site.)


(Make sure you run the last command with sudo - sudo VBoxManage extpack install ... - because otherwise you will get an error like this:

administrator@server1:/tmp$ VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.6-71344.vbox-extpack
0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to install "/tmp/Oracle_VM_VirtualBox_Extension_Pack-4.0.6-71344.vbox-extpack": The installer failed with exit code 127: Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
administrator@server1:/tmp$


)


Now we must add the user that will run VirtualBox (administrator in this example) to the vboxusers group:

sudo adduser administrator vboxusers


VirtualBox is now installed and ready to be used.


To create a VM on the command line, we can use the VBoxManage command. See

VBoxManage --help


for a list of available switches and (highly recommended!) take a look at http://www.virtualbox.org/manual/ch08.html.


I will now create an Ubuntu 11.04 Server VM with 512MB memory and a 10GB hard drive from the Ubuntu 11.04 Server iso image (which I have stored in /home/ubuntu-11.04-server-amd64.iso):

VBoxManage createvm --name "Ubuntu 11.04 Server" --register
VBoxManage modifyvm "Ubuntu 11.04 Server" --memory 512 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0
VBoxManage createhd --filename Ubuntu_11_04_Server.vdi --size 10000
VBoxManage storagectl "Ubuntu 11.04 Server" --name "IDE Controller" --add ide
VBoxManage storageattach "Ubuntu 11.04 Server" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium Ubuntu_11_04_Server.vdi
VBoxManage storageattach "Ubuntu 11.04 Server" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/ubuntu-11.04-server-amd64.iso


Let's assume you have a VM called examplevm that you want to reuse on this host. On the old host, you should have a directory Machines/examplevm in the VirtualBox directory; Machines/examplevm should contain the examplevm.xml file. Copy the examplevm directory (including the examplevm.xml file) to your new Machines directory (if your user name is administrator, this is /home/administrator/.VirtualBox/Machines - the result should be /home/administrator/.VirtualBox/Machines/examplevm/examplevm.xml).


In addition to that copy the examplevm.vdi file from the old VDI directory to the new one (e.g. /home/administrator/.VirtualBox/VDI/examplevm.vdi).


Afterwards, you must register the imported VM:

VBoxManage registervm Machines/examplevm/examplevm.xml


Regardless of if you create a new VM or import an old one, you can start it with the command:

VBoxHeadless --startvm "Ubuntu 11.04 Server"


(Replace Ubuntu 11.04 Server with the name of your VM.)


VBoxHeadless will start the VM and a VRDP (VirtualBox Remote Desktop Protocol) server which allows you to see the VM's output remotely on another machine.


To stop a VM, run

VBoxManage controlvm "Ubuntu 11.04 Server" poweroff


To pause a VM, run

VBoxManage controlvm "Ubuntu 11.04 Server" pause


To reset a VM, run

VBoxManage controlvm "Ubuntu 11.04 Server" reset

The Perfect Server - Ubuntu Natty Narwhal (Ubuntu 11.04) [ISPConfig 2]

This tutorial shows how to set up an Ubuntu Natty Narwhal (Ubuntu 11.04) server that offers all services needed by ISPs and hosters: Apache web server (SSL-capable), Postfix mail server with SMTP-AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL server, Courier POP3/IMAP, Quota, Firewall, etc. In the end you should have a system that works reliably, and if you like you can install the free webhosting control panel ISPConfig 2 (i.e., ISPConfig runs on it out of the box).


I will use the following software:

Web Server: Apache 2.2.17 with PHP 5.3.5, Python, Ruby, and WebDAV Database Server: MySQL 5.1.54Mail Server: PostfixDNS Server: BIND9FTP Server: proftpdPOP3/IMAP: I will use Maildir format and therefore install Courier-POP3/Courier-IMAP.Webalizer for web site statistics

Please note that this setup does not work for ISPConfig 3! It is valid for ISPConfig 2 only!


I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


To install such a system you will need the following:


In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.


Insert your Ubuntu install CD into your system and boot from it. Select your language:


Click to enlarge

Then select Install Ubuntu Server:


Click to enlarge

Choose your language again (?):


Click to enlarge

Then select your location:


Click to enlarge

Click to enlarge

Click to enlarge

If you've selected an uncommon combination of language and location (like English as the language and Germany as the location, as in my case), the installer might tell you that there is no locale defined for this combination; in this case you have to select the locale manually. I select en_US.UTF-8 here:


Click to enlarge

Choose a keyboard layout (you will be asked to press a few keys, and the installer will try to detect your keyboard layout based on the keys you pressed):


Click to enlarge

Click to enlarge

The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network:


Click to enlarge

Click to enlarge The Perfect Server - Ubuntu Natty Narwhal (Ubuntu 11.04) [ISPConfig 2] - Page 2

Wednesday, March 23, 2011

Preparing for Asterisk on Ubuntu 10.10

Through the next few posts, I plan on showing you how to install Asterisk 1.6.x on Ubuntu 10.10, link it to an Avaya S8700/8300 through H.323 and configure it to successfully handle all voicemail.  This project is a great solution for anyone still using an Octel voicemail box, as support is quickly coming to an end (June 2011).  This solution solves a few problems others have been having – including MWI (message waiting indicators) on Avaya telephones AND figuring out what extension was dialed.

I plan on showing an exact step-by-step on my setup, so duplicating it should be very straight forward.   Let’s start with the installation.To begin, you’re going to need a copy of Ubuntu 10.10  Before we go any further, I’m sure there are plenty of users that would love to debate the usage of a certain flavor of *nix over another.  I’m not interested.  I’ve worked with Red Hat, CentOS and Mandrake/Mandriva, but *most* of my experience has been with Ubuntu.  I first installed Dapper Drake on my home machine years ago, and forced myself to become familiar with a Windows alternative.  I am NOT a Linux power user, but feel fairly comfortable with Ubuntu – so I choose to use it for my Asterisk solution.

Installing Ubuntu should be cake, and reproducing a walk-through for this would be repetitive and unnecessary.

After installing Ubuntu, we’re going to need a few packages/libraries prior to installing Asterisk.  If your install requires more than setting up Asterisk as just a voicemail server, you may need additional packages.  In some future posts, I’ll go over this along with step by step instructions on getting things to work (for example – I have my Asterisk box working with Google Voice.  This required 2 more packages and recompiling Asterisk.)

Let’s start by getting a command prompt, and elevating our permissions.

sudo su

Next, let’s install some packages (some might already be installed)

apt-get install ssh
apt-get install gcc
apt-get install ncurses-dev
apt-get install g++
apt-get install flex
apt-get install libcurl3-dev
apt-get install libxml2-dev
apt-get install libiksemel-dev
apt-get install build-essential

Rockin and rollin now!  The system is getting close for our Asterisk install.

If you plan to allow voicemail users to receive voicemail via email, we’ll also want to install Postfix.  To do that type:

apt-get install postfix

During the install of postfix, you will be asked a few questions about how you want Postfix to behave.   On my system, I set Postfix up as a relay server, forwarding mail to our Exchange boxes to be processed.

Optionally, you may want to install Postgres or MySQL to store CDR (call data records) or leverage Asterisk’s Realtime component.  I will cover this in a later post, as my setup uses MySQL to store all voicemail box information – making management a breeze and eliminating the need to reload the voicemail configuration files after each modification.


Saturday, November 6, 2010

Installing Asterisk & its addons on Ubuntu 10.04 LTS Server Edition

First update the Debian reposatory

apt-get update

To install a package on Debian based Linux flavour the command goes as:

sudo apt-get install ...

To install Asterisk on Ubuntu just issue the following command and it will take care of all the dependencies for you.

sudo apt-get install asterisk

The following are the packages that can be added as asterisk addons:

Open Source Private Branch Exchange

Text entry application for asterisk.

Soft fax application for Asterisk.

BRIstuff enabled Asterisk.

Common ISDN API 2.0 implementation for Asterisk.

Open Source Private Branch Exchange orignal DIGIUM version.

Asterisk sample config files.

Debug symbols for asterisk.

Development files for asterisk

Asterisk documentation files.

eSpeak module for Asterisk.

flite module for Asterisk.

Asterisk H.323 VoIP channel.

Bluetooth mobile device support for Asterisk.

MP3 format support(format_mp3) for Asterisk.

MySQL support for asterisk including Asterisk RealTime.

oh323 channel driver for Asterisk.

H.323 protocol support for Astersik, the ooh323c stack.

German voice prompts.

Spanish voice prompts. (Not Free)

Columbian-Spanish voice prompts.

French voice prompts.

French voice prompts by Armelle Desjardins.

French voice prompts.

Italian voice prompts.

Swedish voice prompts.

Additional sound files for Asterisk.

Main sound files for Asterisk.

Web based (CGI) voice mail interface.

Collection of pearl modules to be used with Asterisk PBX AGI.

Asterisk Manager API interface module for Python.

Thursday, September 16, 2010

iRedMail 0.6.1: Open Source Mail Server With Postfix, Dovecot, Amavisd, ClamAV, SpamAssassin, RoundCube On Ubuntu 10.04

Postfix

iRedMail is a shell script that lets you quickly deploy a Open Source Mail Server solution in less than 2 minutes.

It supports Red Hat(R) Enterprise Linux & CentOS 5.x, Debian 5.0.x, Ubuntu 8.04/9.04/9.10/10.04, FreeBSD 7.x/8.x, it supports both i386 and x86_64. Most components used in iRedMail are provided by Linux distributions officially, it means iRedMail users can get software update support for as long as for the distribution itself. It supports OpenLDAP and MySQL as backends to save the virtual domains and virtual users. It offers a web-based admin panel.

iRedMail was initially published in 2007, and now iRedMail 0.6.1 also supports Ubuntu 10.04.

Main components used in this solution: http://code.google.com/p/iredmail/wiki/Main_Components Discussion forum: http://www.iredmail.org/forum/ Project home page: http://code.google.com/p/iredmail/ Project DEMO: http://demo.iredmail.org/

 

1 Requirements

To install such a system you will need the following:

The Ubuntu 10.04 server CD, available here: http://releases.ubuntu.com/releases/10.04/ubuntu-10.04.1-server-i386.iso (i386) or http://releases.ubuntu.com/releases/10.04/ubuntu-10.04.1-server-amd64.iso (x86_64) It is strongly recommended to install a minimal Ubuntu system, and then deploy the mail service via the iRedMail solution.For 10.04 (Lucid, LTS), it is not needed to modify default /etc/apt/sources.list. iRedMail uses packages from the default stable version, both 'main' and 'universe' repositories .

 

2 Preliminary NoteIn this tutorial we use: Hostname: mail.example.com IP address: 192.168.1.10 LDAP suffix: dc

Monday, September 6, 2010

How To Set Up Apache2 With mod_fcgid And PHP5 On Ubuntu 10.04

Follow me on Twitter
Last edited 08/18/2010

This tutorial describes how you can install Apache2 with mod_fcgid and PHP5 on Ubuntu 10.04. mod_fcgid is a compatible alternative to the older mod_fastcgi. It lets you execute PHP scripts with the permissions of their owners instead of the Apache user.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using an Ubuntu 10.04 server in this tutorial with the hostname server1.example.com and the IP address 192.168.0.100.

I will create two Apache vhosts in this tutorial, www.example1.com and www.example2.com, to demonstrate the usage of mod_fcgid.

Make sure you're logged in as root:

sudo su

/bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this:

dpkg-reconfigure dash

Install dash as /bin/sh? <-- No

In addition to that, we must disable AppArmor:

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
aptitude remove apparmor apparmor-utils

 

2 Installing Apache2/mod_fcgi/PHP5

In order to install Apache2, mod_fcgid, and PHP5, run

aptitude install apache2 apache2-suexec libapache2-mod-fcgid php5-cgi

If Apache2 was already installed with PHP5 as an Apache module, disable the PHP5 module now:

a2dismod php5

Then enable the following modules...

a2enmod rewrite
a2enmod suexec
a2enmod include
a2enmod fcgid

... and open /etc/php5/cgi/php.ini:

vi /etc/php5/cgi/php.ini

Uncomment the line cgi.fix_pathinfo

Wednesday, August 25, 2010

Using ATA Over Ethernet (AoE) On Ubuntu 10.04 (Initiator And Target)

Follow me on Twitter
Last edited 08/13/2010

This guide explains how you can set up an AoE target and an AoE initiator (client), both running Ubuntu 10.04. AoE stands for "ATA over Ethernet" and is a storage area network (SAN) protocol which allows AoE initiators to use storage devices on the (remote) AoE target using normal ethernet cabling. "Remote" in this case means "inside the same LAN" because AoE is not routable outside a LAN (this is a major difference compared to iSCSI). To the AoE initiator, the remote storage looks like a normal, locally-attached hard drive.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using two Ubuntu 10.04 servers here:

server1.example.com (Initiator): IP address 192.168.0.100 server2.example.com (Target): IP address 192.168.0.101

 

2 Loading The aoe Kernel Module On Both Systems server1/server2:

Before we start, we must make sure that the the kernel supports AoE:

grep ATA_OVER /boot/config-

Tuesday, August 24, 2010

Chrooting Apache2 With mod_chroot On Ubuntu 10.04

Follow me on Twitter
Last edited 06/15/2010

This guide explains how to set up mod_chroot with Apache2 on an Ubuntu 10.04 system. With mod_chroot, you can run Apache2 in a secure chroot environment and make your server less vulnerable to break-in attempts that try to exploit vulnerabilities in Apache2 or your installed web applications.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm assuming that you have a running Ubuntu 10.04 system with a working Apache2, e.g. as shown in this tutorial: The Perfect Server - Ubuntu Lucid Lynx (Ubuntu 10.04)

Using iSCSI On Ubuntu 10.04 (Initiator And Target)

Follow me on Twitter
Last edited 05/11/2009

This guide explains how you can set up an iSCSI target and an iSCSI initiator (client), both running Ubuntu 10.04. The iSCSI protocol is a storage area network (SAN) protocol which allows iSCSI initiators to use storage devices on the (remote) iSCSI target using normal ethernet cabling. To the iSCSI initiator, the remote storage looks like a normal, locally-attached hard drive.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using two Ubuntu 10.04 servers here:

server1.example.com (Initiator): IP address 192.168.0.100 server2.example.com (Target): IP address 192.168.0.101

Because we will run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string sudo, or we become root right now by typing

sudo su

 

2 Setting Up The Target (server2)server2:

First we set up the target (server2):

aptitude install iscsitarget

Open /etc/default/iscsitarget...

vi /etc/default/iscsitarget

... and set ISCSITARGET_ENABLE to true:

ISCSITARGET_ENABLE

How To Set Up A Webgui Based Print Server On Ubuntu Server Using SWAT, CUPS, And SAMBA

Samba

This how-to describes the process of setting up an intranet based print server using Ubuntu server. By using CUPS SAMBA and SWAT the final product is a webgui based solution to a headless print server.

This How-to has been cobbled together from assorted other how-tos and forums by me after recording as best I could the method I used after googling the various problems I had along the way. It is primarily based on

http://ubuntuforums.org/showthread.php?t

Installing And Using OpenVZ On Ubuntu 10.04

Follow me on Twitter
Last edited 08/18/2010

In this HowTo I will describe how to prepare an Ubuntu 10.04 server for OpenVZ. With OpenVZ you can create multiple Virtual Private Servers (VPS) on the same hardware, similar to Xen and the Linux Vserver project. OpenVZ is the open-source branch of Virtuozzo, a commercial virtualization solution used by many providers that offer virtual servers. The OpenVZ kernel patch is licensed under the GPL license, and the user-level tools are under the QPL license.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using an x86_64 (amd64) system here. If you are on an i386 system, a few commands will be slightly different - I have added annotations to that parts.

 

2 Become root

Type

sudo su

to become root (or prepend all commands in this tutorial with the string sudo).

 

3 Change The Default Shell

/bin/sh is a symlink to /bin/dash, however we need /bin/bash, not /bin/dash. Therefore we do this:

dpkg-reconfigure dash

Install dash as /bin/sh? <-- No

 

 

4 Disable AppArmor

AppArmor is a security extension (similar to SELinux) that should provide extended security. In my opinion you don't need it to configure a secure system, and it usually causes more problems than advantages (think of it after you have done a week of trouble-shooting because some service wasn't working as expected, and then you find out that everything was ok, only AppArmor was causing the problem). Therefore I disable it.

We can disable it like this:

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

 

5 Installing OpenVZ

Unfortunately there are no OpenVZ packages in the official Ubuntu 10.04 repositories, therefore we have to build the OpenVZ kernel and the OpenVZ tools (vzctl, vzquota, vzpkg) ourselves.

First, run

uname -r

to find out your currently installed kernel version:

root

Monday, August 23, 2010

VMware Server 2.0.2-x On Ubuntu Server 10.04 With VMware Remote Console Plug-in

Virtualization

Today I will tell you how to set up a new Ubuntu 10.04 server which runs VMware server 2.0.2-x and the VMware Remote Console Plug-in.

My box:

CPU: Intel(R) Celeron(R) D CPU 3.06GHz, 1 core
Memory: 2GB
CD-ROM

Firefox 3.6 can not run the VMware Remote Console. On the client, I use Chrome to build virtual machines, then I use the VMware Remote Console Plug-in to run them.

We have four steps:

Step one: Set up a new box running Ubuntu server.
Step two: Register, download, patch, and install VMware.
Step three: Create virtual machines.
Step four: Control remote virtual machines with the VMware Remote Console Plug-in from a client.

 

Step one: Set up a new box running Ubuntu server

Very easy. If you don't know, look at: http://www.howtoforge.com/perfect-server-ubuntu-10.04-lucid-lynx-ispconfig-3.

After the setup, reboot the box.

Log in and activate the root account:

sudo passwd root

Type in the password for root, I choose: 111111

Log out then log in as root and later we do everything as root, too.

Upgrade the box:

apt-get update
apt-get upgrade -y

Install gcc:

apt-get install -y gcc

Configure a static IP address (I use 192.168.1.75 here):

nano /etc/network/interfaces

Delete everything and replace with:

# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback # The primary network interfaceauto eth0iface eth0 inet static address 192.168.1.75 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1

Edit /etc/resolv.conf:

nano /etc/resolv.conf

Delete everything and replace with (make sure you use a valid nameserver; in this example I use 192.168.1.1, my router, which runs a nameserver as well):

nameserver 192.168.1.1

Reboot the box:

reboot

 

Step two: Register, download, patch, install VMware

Log on as root and create /root/vm:

mkdir /root/vm
cd /root/vm

To download VMware, you have to register at: https://www.vmware.com/tryvmware/?p