Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts

Thursday, February 17, 2011

Installing vzdump on CentOS 5.4 (32-bit)

There are a few items required for installing vzdump for OpenVZ on 32bit CentOS.

First, make sure you read the installation post covering the 64bit install. Here are the commands for 32bit. Here is how you get vzdump on a clean version of 32bit CentOS (via the hostnode):

rpm -ivh "ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/i386/RPMS.dag/cstream-2.7.4-3.el5.rf.i386.rpm"wget http://dag.wieers.com/rpm/packages/perl-LockFile-Simple/perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpmrpm -ivh perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm/bin/rm perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpmrpm -ivh "http://chrisschuld.com/centos54/vzdump-1.2-6.noarch.rpm"

Make sure you add in the PERL5LIB in your export (see the 64bit post):

export PERL5LIB=/usr/share/perl5/

Monday, February 7, 2011

Updating Ghostscript on CentOS 5.4 (ghostscript 8.70) (the remix)

A while back I wrote an article on updating to ghostscript 8.63 on CentOS 5.2. I received a fair amount of email and comments on the topic ranging from “thanks” to “you don’t know what your talking about!” I thought I would update the original post to include the latest release of ghostscript (8.7) as well as answer and respond to the best question / statement in the comments… “how do you do that and can you post the SRPMS?” The answer is, yes, here is how I do it and “yes” I’ll post the SRPMs (or more appropriately where I get them).

First, you have to have the latest version of the build environment as well as some prerequisites for building GhostScript:

yum --enablerepo remi groupinstall "Development Tools"yum --enablerepo remi install libjpeg-devel libXt-devel libpng-devel gtk2-devel glib2-devel gnutls-devel libxml2-devel libtiff-devel cups-devel libtool jasper-devel

(you will note here I use the REMI repo)

Next, I obtain the SRPM files from rpmfind.net and ghostscript-fonts from the centos repo:

wget ftp://195.220.108.108/linux/fedora/development/source/SRPMS/ghostscript-8.70-3.fc13.src.rpm wget http://mirror.centos.org/centos/5.4/os/SRPMS/ghostscript-fonts-5.50-13.1.1.src.rpm

Now, I build them using RPM (rpmbuild):

rpmbuild --rebuild ghostscript-8.70-3.fc13.src.rpmrpmbuild --rebuild ghostscript-8.70-1.fc10.src.rpm

… and that is how I do it! If you are feeling exceptionally lazy and have some inherent trust for my builds in x86_64… here they are:

rpm -Uvh http://chrisschuld.com/centos54/ghostscript-8.70-1.x86_64.rpm http://chrisschuld.com/centos54/ghostscript-fonts-5.50-13.1.1.noarch.rpm http://chrisschuld.com/centos54/ghostscript-gtk-8.70-1.x86_64.rpm

Installing vzdump for OpenVZ on CentOS

There are a few items required for installing vzdump for OpenVZ on CentOS.


First, you’ll need an MTA – I suggest making sure you have postfix installed; if you have postfix installed the initial RPM requirement for “MTA” will be handled for you. Next, you’ll need cstream. This installation is slightly more tricky because (as far as I know) there is no real way to gain this from yum unless you use the DAG Wieers repo. Also, depending on what you have already installed you will likely need the Simple Locking file I/O library for Perl.


Here is how you get vzdump on a clean version of CentOS (via the hostnode):

rpm -ivh "ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/x86_64/RPMS.dag/cstream-2.7.4-3.el5.rf.x86_64.rpm"wget http://dag.wieers.com/rpm/packages/perl-LockFile-Simple/perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpmrpm -ivh perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm/bin/rm perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpmrpm -ivh "http://chrisschuld.com/centos54/vzdump-1.2-6.noarch.rpm"

Since version 1.2-6 of vzdump the location of the modules is not “automatic” and have found it necessary to export the location of the PVE libraries that vzdump requires via this command:

export PERL5LIB=/usr/share/perl5/

Monday, January 3, 2011

Installing FreePBX 2.8 with Asterisk 1.8 on CentOS 5.5

FreePBX has become quite popular over the last few years. Unfortunately, the documentation has not quite caught up to the popularity. At the time of this writing, most of the documentation available was for older versions of CentOS, FreePBX and/or Asterix. Below I have outlined the steps required to get FreePBX 2.8 working with Asterisk 1.8 on CentOS 5.5.


If you are reading this as after having followed the steps in my previous article Installing CentOS 5.5 with Linux Integration Services 2.1 on Hyper-V R2 or if you have not selected the following package groups during your installation of CentOS, make sure you do so now by using the following commands.

You will need five different passwords.

PASSWORD1 – Your root password.
PASSWORD2 – Used for the asterisk database user.
PASSWORD3 – Used for the FreePBX administrator.
PASSWORD4 – Used for Flash Operator Panel.
PASSWORD5 – Used for the Asterisk Recording Interface.

yum groupinstall "DNS Name Server"yum groupinstall "Web Server"yum groupinstall "Mail Server"yum groupinstall "MySQL Database"yum groupinstall "Development Tools"

Once you are sure that the needed package groups are installed, you will want to install the prerequisites as follows.

yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-develyum install gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-develyum install openssl-devel mysql-devel zlib-devel perl-DateManip sendmail-cf sox

Make sure you also have wget installed.

yum install wget

Next you will setup named.

echo "options {" >> /var/named/chroot//etc/named.confecho " directory \"/var/named\";" >> /var/named/chroot//etc/named.confecho " dump-file \"/var/named/data/cache_dump.db\";" >> /var/named/chroot//etc/named.confecho " statistics-file \"/var/named/data/named_stats.txt\";" >> /var/named/chroot//etc/named.confecho "};" >> /var/named/chroot//etc/named.confecho "include \"/etc/rndc.key\";" >> /var/named/chroot//etc/named.confcd /var/named/chroot//etc/chmod 640 named.confchgrp named named.confln -s /var/named/chroot//etc/named.conf /etc/named.conf

You will want to adjust the security settings as per your requirements but for the simplicity of this article, we are going to turn off Security-Enhanced Linux and open the firewall fully.

echo "SELINUX=disabled" > /etc/selinux/configiptables -P INPUT ACCEPTiptables -P OUTPUT ACCEPTiptables -P FORWARD ACCEPTiptables -Fiptables -X/etc/init.d/iptables save

LAME is required for Asterisk’s audio related functions. You will want to download LAME to a source directory, compile and then install it.

cd /usr/srcwget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?ts=1292626574&use_mirror=cdnetworks-us-1tar zxvf lame-3.98.4.tar.gzcd lame-3.98.4./configuremakemake install

You can optionally remove the source once you have installed LAME.

cd ..rm -fr lame-3.98.4rm lame-3.98.4.tar.gz

Before continuing, insure that all packages are up to date and then reboot.

yum updatereboot

Get Asterisk 1.8 and extract it to its own source folder.

cd /usr/srcwget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gztar xvfz asterisk-1.8-current.tar.gzcd asterisk-1.8.0contrib/scripts/get_mp3_source.sh./configuremake menuconfig

The last command will launch the source configuration manager. The only portions you will want to install are app_mysql, app_saycountpl, cdr_mysql, format_mp3, res_config_mysql and EXTRAS-SOUNDS-EN-GSM (which can be found in the Extra Sound Packages sub-menu). Save your selections and exit. Now compile the source and install.

makemake install

You can optionally remove the source directory once you have installed Asterisk.

cd ..rm -fR asterisk-1.8.0rm asterisk-1.8-current.tar.gz

Get FreePBX 2.8 and extract it to its own source folder.

cd /usr/srcwget http://mirror.freepbx.org/freepbx-2.8.0.tar.gztar xvfz freepbx-2.8.0.tar.gzcd freepbx-2.8.0

Start MySQL, create the asterisk databases and run the initial SQL setup scripts.

/etc/init.d/mysqld startchkconfig mysqld onmysqladmin create asteriskmysqladmin create asteriskcdrdbmysql asterisk < SQL/newinstall.sqlmysql asteriskcdrdb < SQL/cdr_mysql_table.sql

Start the MySQL command line.

mysql

Define the user and password for each of the databases.

GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';flush privileges;\q

Change the MySQL user to root.

mysqladmin -u root password 'PASSWORD1'

Create the Asterisk user and set folder permissions.

useradd -c "Asterisk PBX" -d /var/lib/asterisk asteriskchown -R asterisk:asterisk /var/run/asteriskchown -R asterisk:asterisk /var/log/asteriskchown -R asterisk:asterisk /var/lib/php/session/

Update the Apache configuration file.

vi /etc/httpd/conf/httpd.conf

Change User apache and Group apache to User asterisk and Group asterisk.

Change AllowOverride None to AllowOverride All.

Update ServerName to use your server’s FQDN.

Start Apache.

/etc/init.d/httpd startchkconfig httpd on

Start Asterisk.

./start_asterisk start

Configure FreePBX.

./install_amp --username=asteriskuser --password=PASSWORD2

The next series of prompts will give you default values within square brackets which you can accept by hitting enter. If you wish to change a value, simply type it and hit enter after.

[asteriskuser]

This is the database user you specified earlier.

[PASSWORD2]

This is the password for the database user.

[localhost]

Use the default value.

[admin]

The username for the FreePBX administrator.

[amp111]

The password for the FreePBX administrator. It is important to change this. (Use PASSWORD3 you prepared earlier.)

[/var/www/html]

Use the default value.

[xx.xx.xx.xx]

The public IP that will be used.

[passw0rd]

The Flash Operator Panel password. It is important to change this. (Use PASSWORD4 you prepared earlier.)

[extensions]

Use the default value.

[/var/lib/asterisk/bin]

Use the default value.

[/usr/local/sbin]

Use the default value.

Change the Asterisk Recording Interface password and turn on user authentication for the web interface by editing the amportal.conf file.

vi /etc/amportal.conf

Change the ARI_ADMIN_PASSWORD entry to update the ARI password.

ARI_ADMIN_PASSWORD=PASSWORD5

Change the AUTHTYPE entry to database to enable authentication.

AUTHTYPE=database

Optionally, you can turn off the FOP completely by changing the following settings.

FOPRUN=falseFOPDISABLE=true

Save and exit.

Add FreePBX to the boot process.

echo "/usr/local/sbin/amportal start" >> /etc/rc.local

You can ensure that the administrator user has the proper password in the database by navigating to the Administrators tab, choosing the admin user and clicking on the Update password link. Once your password has been updated, logout by clicking the link at the top right of the page.

Finally, reboot the server one last time.

reboot

Installing CentOS 5.5 with Linux Integration Services 2.1 on Hyper-V R2

Hyper-V R2 brings some powerful virtualization to the table for those of us who do not have either the skills or the desire to work with virtual machineware. Most fans of Hyper-V are also likely to be well versed in Windows and may often lack the knowledge to rummage through Linux. Although there are many resources available regarding Linux on Hyper-V, I felt that most assumed the reader had intimate knowledge with Linux, which is often not the case.

For Windows administrators new to Linux who wish to provide virtualized services to their end-users, my recommendation is to stick to CentOS 5.5. Being a close derivative of Red Hat Enterprise Linux (RHEL), the officially supported distribution by Microsoft, installation of the Integration Components is simplified and stability is matched to what is found when running RHEL.

You will need the CentOS 5.5 x64 installation DVD ISO (CentOS-5.5-x86_64-bin-DVD-1of2.iso) which can be found at http://isoredirect.centos.org/centos/5/isos/x86_64/.

You will also need the Linux Integration Services 2.1 ISO (LinuxIC v21.iso) available through the Microsoft Download Center at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eee39325-898b-4522-9b4c-f4b5b9b64551.

To create the initial virtual machine, you will need to use the Legacy Network Adapter and limit yourself to a single CPU. You will also want to take time to decide how large of a VHD to allocate ahead of time as expanding a Linux partition can be a little complicated. Personally, I find 20GB to be sufficient for small, single purpose Linux virtual machines.

After booting from the CentOS ISO, you are presented with the choice to do a graphical or a text mode installation. To choose the text mode installation (as used here), simply type “linux text” at the boot: prompt and hit enter.

To navigate throughout the next portion of the text mode installation, use the Tab key to navigate between fields and the Space key to select options or hit buttons.

You will be asked if you would like to do a media test. You can safely skip this.

The initial welcome screen to the installation process.

Choose your language as appropriate.

And your keyboard.

You must then partition your VHD for Linux. As you will be starting off with a fresh VHD, you can simply choose “Use free space on selected drives and create default layout.” and continue with OK.

Be sure to hit No to continue as hitting Yes will simply bring you back to the previous screen.

As long as you have properly configured your virtual machine to use the Legacy Network Adapter, you will be presented with the opportunity to have the installation configure it for you.

Check the “Enable IPv4 support” option and hit OK to continue.

Switch to the “Manual address configuration” option and enter your IP address and netmask as appropriate.

Continue on by entering your default gateway (usually your router or your network’s default route). If you have internal DNS servers for your network, enter them here or alternatively, you can use OpenDNS.

The name of your virtual machine is defined here as the hostname.

Select your time zone and continue.

Be sure to choose a secure root password as the root user has complete access to the entire virtual machine and SSH is enabled on first boot.

For a bare minimum installation, uncheck all of the packages, check “Customize software selection” and hit OK.

Uncheck all package groups and continue. Anything you require can later be installed by yum anyway.

Installation will begin once you continue past this screen.

Once installation is complete, you will be required to reboot.

After rebooting, you will be ready to login. At this point, I recommend connecting via SSH in order to copy and paste commands.

The first thing that must be done is to update all the base packages and upgrade the kernel to the latest version. Simply run a “yum update”, then reboot.

yum updatereboot

You will need to install the required packages “kernel-devel”, “gcc” and “make” packages to compile and install the Linux Integration Components. Also, I suggest installing the VIM text editor.

yum install kernel-develyum install gccyum install makeyum install vim-enhanced.x86_64

Attach the Linux Integration Services ISO. Once attached, you will need to mount the cdrom. You must then copy and compile the source in a temporary folder. Finally, you will be able install the Linux Integration Components. “make” will compile the source, then “make install” will install the compiled drivers.

mkdir -p /mnt/cdrommount /dev/cdrom /mnt/cdromcp -rp /mnt/cdrom /opt/linux_icumount /mnt/cdromcd /opt/linux_icmakemake install

The time synchronisation component is not compatible with CentOS, therefore you will need to install “adjtimex”.

yum install adjtimex

You will need to shutdown the virtual machine in order to enable the Synthetic Network Adapter and increase the number of CPUs allocated. To do so, run the shutdown command.

shutdown -h -t 0 0

Change the settings in Hyper-V once the virtual machine has completely shutdown.

Start the virtual machine and log in. You will need to reconfigure the network adapter as “eth0? will have disapeared and a new adapter, “seth0?, will have taken its place.

The easiest way to do this is to edit the MAC address in the “eth0? backup file to match the MAC address of the Network Adapter as displayed in the virtual machine settings in Hyper-V, then copy the backup file as “seth0? and restart the network service.

vi /etc/sysconfig/network-scripts/ifcfg-eth0.bak(edit HWADDR)(save and exit)rm -f /etc/sysconfig/network-scripts/ifcfg-seth0mv /etc/sysconfig/network-scripts/ifcfg-eth0.bak /etc/sysconfig/network-scripts/ifcfg-seth0service network restart

If all went well, you will find yourself with a bare minimum install of CentOS 5.5 running the latest kernel and version 2.1 of the Linux Integration Services. Fully virtualized and synthetic. You can now enjoy the many benefits of Hyper-V Linux such as the ability to shutdown the virtual machine without the root password.

Wednesday, August 25, 2010

Installing Linux Integration Services v2.1 Hyper-V R2 On CentOS 5

Virtualization Introduction

When installed on a virtual machine that is running a supported Linux operating system, Linux Integration Services for Hyper-V provides the following functionality:

Driver support for synthetic devices: Linux Integration Services supports the synthetic network controller and the synthetic storage controller that were developed specifically for Hyper-V. Fastpath Boot Support for Hyper-V: Boot devices now take advantage of the block Virtualization Service Client (VSC) to provide enhanced performance. Timesync: The clock inside the virtual machine will remain synchronized with the clock on the host. Integrated Shutdown: Virtual machines running Linux can be shut down from either Hyper-V Manager or System Center Virtual Machine Manager, using the "Shut Down" command.
Symmetric Multi-Processing (SMP) Support: Supported Linux distributions can use up to 4 virtual processors (VP) per virtual machine.
1. Download Linux Integration Components v2.1

a. Download Linux Integration Components v2.1 from Microsoft Download site.

b. Extract the .exe file into a temp folder. You will need only LinuxIC v21.iso file.

c. Place the LinuxIC v21.iso file into your VM host server where you can mount the ISO as a CDROM for your Centon Virtual Machine.

 

2. Installation

You will need Development Tools installed to be able to compile the Integration Components. You could do that by running yum:

yum groupinstall "Development Tools"

NOTE: This command will try to use your network connection to download and if you used Synthetic Network Adapter for your Hyper-V machine you will not have internet connection. So make sure to install Development Tools during your Centos initial installation.

Now make sure you added LinuxIC v21.iso file to your Hyper-V CDROM as Image.

As the root user, mount the CD in the virtual machine by issuing the following commands at a shell prompt:

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom

Copy Linux Integration Services to the virtual machine and unmount CDROM that no longer needed:

mkdir /opt/linux_ic_v21_rtm
cp