Archive for CentOS5

Installing Webmin with YUM (CentOS,RHEL)

Here are the commands to install Webmin via Yum:

echo -e "[Webmin]\nname=Webmin Distribution Neutral\nbaseurl=http://download.webmin.com/download/yum\nenabled=1" > /etc/yum.repos.d/webmin.repo
rpm --import http://www.webmin.com/jcameron-key.asc
yum install webmin

Adding NFS support to an OpenVZ VPS

I still use a lot of NFS connections on my equipment and when I create OpenVZ VPS systems I need them to have access to NFS. Here are the steps I use:

From the Host Node (HN):

modprobe nfs
vzctl set 101 --features "nfs:on" --save

From the VPS:

yum -y install nfs-utils nfs-utils-lib
chkconfig --levels 345 portmap on
/etc/init.d/portmap start

Setting up an OpenVZ VPS DNS Server in CentOS 5.3

Here is my quick-and dirty way to build DNS servers using OpenVZ, CentOS and Bind/Named. This assumes you are creating a new server via OpenVZ. Although Bind is easy to admin with the configuration files recently I have found it is easier to simply admin the zones with Webmin. This setup will create the VPS, install Bind and install Webmin.

Create the VPS:

cid=1161
cd /vz/template/cache/
wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz
vzctl create ${cid} --ostemplate centos-5-x86_64 --config vps.basic
vzctl set ${cid} --hostname [HOSTNAMEHERE] --save
vzctl set ${cid} --ipadd [IP] --save
vzctl set ${cid} --nameserver [IP] --save
vzctl start ${cid}
vzctl exec ${cid} passwd
vzctl enter ${cid}

From inside the VPS I install bind and webmin

yum -y install bind bind-chroot bind-libs bind-utils caching-nameserver
cd /root
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.480-1.noarch.rpm
rpm -Uvh webmin-1.480-1.noarch.rpm

Now I simply visit webmin’s panel and tap in any new zones (or copy over our zones from another box).

OpenVZ and virtual serving makes this time-consuming task of bringing new boxes up a simple task!

Installing OpenVZ in CentOS 5.3 (64bit)

There are a few tutorials out there on installing OpenVZ in CentOS 5.3. Here are the steps I use to install OpenVZ on a brand new installation of CentOS 5.3:

Note: this tutorial / walkthrough is for use 64 bit only

  1. Update the box via yum
  2. Install the OpenVZ Repository and grab the GPG key
  3. Install OpenVZ
  4. Install OpenVZ Controller and Quota system
  5. Configure the local system for the OpenVZ kernel
  6. Update OpenVZ’s ARP Settings
  7. Disable SELINUX
  8. Reboot
yum -y update
cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum -y install ovzkernel.x86_64
yum -y install vzctl.x86_64 vzquota.x86_64

Now; we need to configure the sysctl.conf file for OpenVZ

perl -pi -e 's/net\.ipv4\.ip_forward = 0/net\.ipv4\.ip_forward = 1/' /etc/sysctl.conf
perl -pi -e 's/kernel\.sysrq = 0/kernel\.sysrq = 1/' /etc/sysctl.conf
echo -e "\n\nnet.ipv4.conf.default.proxy_arp = 0\nnet.ipv4.conf.all.rp_filter = 1\nnet.ipv4.conf.default.send_redirects = 1\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.icmp_echo_ignore_broadcasts=1\nnet.ipv4.conf.default.forwarding=1\nkernel.ve_allow_kthreads=1\n" >> /etc/sysctl.conf
perl -pi -e 's/NEIGHBOUR_DEVS=detect/NEIGHBOUR_DEVS=all/' /etc/vz/vz.conf

Disable SELINUX

vi /etc/sysconfig/selinux

Reboot the machine

reboot

Installing a standard Bind DNS server on an VPS (openvz)

All of our name servers I use are virtual servers and we add them into our network as OpenVZ VPS systems.  Here is the setup I use for setting up a Bind server on an OpenVZ VPS with CentOS 5.

Setup the Open VZ VPS and get into the VPS:

vzctl create 1031 --ostemplate centos-5-i386-default --config vps.basic
vzctl set 1031 --hostname ns4.aztecsoftware.net --save
vzctl set 1031 --ipadd 10.0.0.31 --save
vzctl set 1031 --nameserver 10.0.0.30 --save
vzctl start 1020
vzctl enter 1020

Now that you are in the VPS update the OS and get Bind updated:

yum -y erase bind* caching-nameserver
rm -rf /var/named
yum -y install bind*
yum -y update

Get the DNS key through dns-keygen (copy the key):

/usr/sbin/dns-keygen

Start the DNS Setup:

touch /var/named/chroot/etc/named.external.zones
touch /var/named/chroot/etc/named.internal.zones
cp /usr/share/doc/bind-9.3.4/sample/etc/named.* /var/named/chroot/etc/
cp /usr/share/doc/bind-9.3.4/sample/var/named/named.root /var/named/chroot/var/named/
chown named:named /var/named/chroot/var/named/named.root

I am not going to get into details on how to setup your named.conf — as mainly this is a command reference for myself in the future (aren’t I selfish). However, here is my list:

  • Remove the Caching Server View (localhost_resolver) because we do not need it because we are not using the caching only name server
  • Setup the zones for internal and external and point them to the touched files above (named.external.zones and named.internal.zones)
  • Make sure you are not in a position where you can fall subject to the cache poison.
vi /var/named/chroot/etc/named.conf

How to install “dig”: -bash: /usr/bin/dig: No such file or directory

If you are missing the dig command it means you are missing a package called bind-utils.  To install this package use yum to install bind utils:

yum install bind-utils

Or if you do not have access to yum, maybe from a hosted VPS solution you can grab the RPM packages (this is 100% assuming you are CentOS):

rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/bind-utils-9.3.4-6.P1.el5.i386.rpm

Or maybe you want to install the entire bind/named system:

rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/bind-9.3.4-6.P1.el5.i386.rpm
rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/bind-chroot-9.3.4-6.P1.el5.i386.rpm
rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/bind-libs-9.3.4-6.P1.el5.i386.rpm
rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/caching-nameserver-9.3.4-6.P1.el5.i386.rpm
rpm -i http://mirror.centos.org/centos/5/os/i386/CentOS/bind-utils-9.3.4-6.P1.el5.i386.rpm

Building an IAXModem-based HylaFax+ server using OpenVZ

If you happen to have a Asterisk solution for voice on your network occasionally it is nice to be able to send faxes from your network without the need of a PSTN line at your endpoint. At my company we do this by running a fax server on an OpenVZ VPS on the same subnet as our Asterisk PBX. Here is how we build our fax server:

First, we build the OpenVZ VPS with CentOS and add the /dev/ptmx device (your VPS will likely already have this on it):

vzctl create 1057 --ostemplate centos-5-i386-default --config vps.basic
vzctl set 1057 --hostname fax.aztecsoftware.net --save
vzctl set 1057 --ipadd 10.0.0.57 --save
vzctl set 1057 --nameserver 10.0.0.15 --save
mknod --mode 666 /vz/private/1057/dev/ptmx c 5 2

(Note: there is a good chance the 98 UNIX device /dev/ptmx is going to already be there from your template — you can disregard any errors you get during the “forced” creation of that device)

Next, we start the VPS and enter the VE by running the following:

vzctl start 1057
vzctl enter 1057

Next, we start the update and install process via yum and a few RPMs I built for Ghostscript:

yum -y update
yum -y install rpm-build make libtiff-devel zlib-devel gcc gcc-c++ pam-devel openldap-devel freeglut libjpeg-devel libICE libSM libXt cairo urw-fonts
 
rpm -Uvh http://chrisschuld.com/centos52/jasper-libs-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-utils-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-devel-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-fonts-8.11-1ht.noarch.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-8.63-1.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-devel-8.63-1.i386.rpm
 
cd /root
wget http://internap.dl.sourceforge.net/sourceforge/hylafax/hylafax-5.2.7-1.src.rpm
wget http://internap.dl.sourceforge.net/sourceforge/hylafax/hylafax.spec
 
rpm -i hylafax-5.2.7-1.src.rpm
rpmbuild -bb hylafax.spec
rpm -i /usr/src/redhat/RPMS/i386/hylafax-5.2.7-1.i386.rpm
chkconfig --levels 345 hylafax on

Now, because we are on Asterisk we’ll use an IAXModem for our communication device; if you do have access to a “real” PSTN by all means use a fax-capable modem and don’t use the IAXModem because it is not a good 100% solution. However, here is our IAXModem method:

cd /root
wget http://voxel.dl.sourceforge.net/sourceforge/iaxmodem/iaxmodem-1.1.1.tar.gz
tar xzvf iaxmodem-1.1.1.tar.gz
cd iaxmodem-1.1.1
./configure
make
cp iaxmodem /usr/local/sbin/
mkdir /etc/iaxmodem /var/log/iaxmodem
touch /var/log/iaxmodem/iaxmodem
pushd .; cd /etc/iaxmodem
wget http://chrisschuld.com/wp-content/uploads/2008/11/ttyIAX0
popd
pushd .; cd /etc/init.d/
wget http://chrisschuld.com/wp-content/uploads/2008/11/iaxmodem
popd
cp config.ttyIAX /var/spool/hylafax/etc/config.ttyIAX0
 
### Add our local configuration differences
vi /etc/iaxmodem/ttyIAX0
 
### Add our local configuration differences
vi /var/spool/hylafax/etc/config.ttyIAX0
 
chmod +x /etc/init.d/iaxmodem
chkconfig --add iaxmodem
/usr/local/sbin/iaxmodem
echo "iax0:2345:respawn:/usr/sbin/faxgetty ttyIAX0" >> /etc/inittab

Now, we REBOOT to make sure everything comes up:

reboot

After the VE re-appears we run our fax setup program:

faxsetup

That should do 90% of the work for you — no you just have to configure the server for your needs!

Updating Ghostscript on CentOS 5.2 (ghostscript 8.63)

PLEASE NOTE: I have posted an update for CentOS5.4 and GhostScript 8.70!

Today I needed a newer version of ghostscript on my server pool for some back-end processing we do. Updating ghostscript for RHEL5 / CentOS 5.2 turned out to be a pain! I was nearly stucked into RPM hell!

   **** Warning:  An error occurred while reading an XREF table.
   **** The file has been damaged.  This may have been caused
   **** by a problem while converting or transfering the file.
   **** Ghostscript will attempt to recover the data.
ERROR: /undefined in /BXlevel
Operand stack:
   7   0   1   --dict:6/6(ro)(G)--   obj
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--
Dictionary stack:
   --dict:1119/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:18/24(L)--
Current allocation mode is local
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

A few google-searches later I realized that ghostscript 8.15 is “old school” and needed a serious update. I always like to have the latest software (generally speaking) so I was after the latest version to date (version 8.63) to hopefully solve some problems with PDF translation:

First, you’ll need the jasper libraries which are not available via yum. You can get them here (i386 32bit only for now):

 
rpm -Uvh http://chrisschuld.com/centos52/jasper-libs-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-utils-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-devel-1.900.1-8.i386.rpm

Next, here are the RPMs for RHEL5/CentOS5.2 for Ghostscript (i386 32bit only for now):

 
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-8.63-1.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-devel-8.63-1.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-gtk-8.63-1.i386.rpm

*** Problem solved!

PLEASE NOTE: I have posted an update for CentOS5.4 and GhostScript 8.70!

Installing PBX in a Flash (PIAF) on an OpenVZ VPS

After digging through the Internet looking for a solution to install PBX in a Flash on an OpenVZ VPS and coming out empty handed I decided to dissect the installation myself and I came up with the following method for installing the PBX system on an OpenVZ VPS. Now, that being said I could not find another “working” solution so this may not be the “best” method but it is repeatable and does work. I have a PBX running off this installation currently.

In this example I am going to assume the VPS is VEID 1024 whose IP address will be 10.0.0.24, running on a 10.0.0.0/24 network NAT’ed behind a router with a name server located at 10.0.0.10.

I am also going to assume you have OpenVZ installed, if you don’t visit here: http://www.howtoforge.com/installing-and-using-openvz-on-centos5.2

First, you have to create the OpenVZ VPS container using a CentOS 5 template:

cd /vz/template/cache
wget http://download.openvz.org/template/precreated/contrib/centos-5-i386-default.tar.gz
vzctl create 1024 --ostemplate centos-5-i386-default --config vps.basic
vzctl set 1024 --onboot yes --save
vzctl set 1024 --hostname pbx.mycompany.net --save
vzctl set 1024 --ipadd 10.0.0.24 --save
vzctl set 1024 --nameserver 10.0.0.10 --save
vzctl set 1024 --devices c:4:9:rw --save
vzctl start 1024
vzctl enter 1024

NOTE: you will need access to 13 RPM files from the ISO version of PBX in a Flash so grab the CD so you can get access to the following files:

c-ares-1.3.2-1.i386.rpm
ez-ipupdate-3.0.11b8-3.i386.rpm
flite-1.3-8.fc7.i386.rpm
flite-devel-1.3-8.fc7.i386.rpm
iksemel-1.2-13.i386.rpm
ircd-hybrid-7.2.1-1.i386.rpm
jpackage-utils-1.7.3-1jpp.2.el5.noarch.rpm
lame-3.97-1.fc6.rf.i386.rpm
lha-1.14i-17.i386.rpm
piafdl-0.1-1.noarch.rpm
piafxtras-0.1-1.noarch.rpm
shared-mime-info-0.19-5.el5.i386.rpm
MySQL-shared-compat-5.0.41-0.rhel4.i386.rpm

I looked to find them all online but could not (if anyone knows if they are available please let me know and I will update the site); otherwise I would simply provide the URLs to each file.

Inside of the “fresh” VE I update the root password, copy the RPMs from the CD (see above) and the system using yum:

passwd
mkdir -p /root/piaf/pbx/
#mount the CD here or SCP the files from the CD (or many other options -- but put the 13 RPMs in /root/piaf/pbx/)
scp -r root@SOME_SYSTEM_WITH_CD_MOUNTED:/mnt/cdrom/pbx/* /root/piaf/pbx/
yum -y update

Next, I add all of the packages necessary for PBX in a Flash. This list comes from the ISO CD and the packages that are included across the board for the PBX in a Flash for all cases; I know that it is NOT necessary to have all of these packages; however; I just needed the PBX to work and by adding all of the packages ensures you will have every component for the initial instalation!

yum -y install GConf2 MAKEDEV NetworkManager ORBit2 OpenIPMI OpenIPMI-libs SysVinit acpid alsa-lib alsa-utils amtu anaconda anaconda-runtime anacron apmd apr apr-util arts aspell aspell-en at atk attr audiofile audiofile-devel audit audit-libs audit-libs-python authconfig authconfig-gtk autoconf autofs automake avahi avahi-glib avahi-qt3 basesystem bash bc beecrypt bind bind-libs bind-utils binutils bison bluez-gnome bluez-libs bluez-utils booty busybox-anaconda bzip2 bzip2-libs c-ares cairo ccid cdparanoia-libs centos-release centos-release-notes chkconfig chkfontpath comps-extras conman coolkey coreutils cpio cpp cpuspeed cracklib cracklib-dicts crash createrepo crontabs cryptsetup-luks cups cups-libs curl curl-devel cvs cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain db4 dbus dbus-glib dbus-python dejavu-lgc-fonts desktop-backgrounds-basic desktop-file-utils device-mapper device-mapper-multipath dhcdbd dhclient dhcp dhcpv6-client diffutils dmidecode dmraid dos2unix dosfstools dump
 
yum -y install e2fsprogs e2fsprogs-devel e2fsprogs-libs ed eject elfutils elfutils-libelf elfutils-libs esound ethtool exim expat fbset file filesystem findutils finger firstboot firstboot-tui flex fontconfig freetype ftp gamin gamin-devel gamin-python gawk gcc gcc-c++ gd gdbm gettext glib2 glib2-devel glibc glibc-common glibc-devel glibc-headers gmp gnome-keyring gnome-mime-data gnome-mount gnome-python2 gnome-python2-bonobo gnome-python2-canvas gnome-python2-gconf gnome-python2-gnomevfs gnome-vfs2 gnupg gnutls gnutls-utils gpm grep groff grub gtk2 gtk2-devel gtk2-engines gzip hal hesiod hicolor-icon-theme htdig htmlview httpd hwdata ibmasm ifd-egate imake info initscripts iproute ipsec-tools iptables iptables-ipv6 iptstate iputils irda-utils irqbalance isdn4k-utils
 
yum -y install joe jpackage-utils jwhois kbd kdelibs kdnssd-avahi kernel kernel-devel kernel-headers keyutils keyutils-libs keyutils-libs-devel kpartx krb5-devel krb5-libs krb5-workstation ksh kudzu lcms less lftp libFS libICE libIDL libSM libX11 libXScrnSaver libXTrap libXau libXaw libXcomposite libXcursor libXdamage libXdmcp libXext libXfixes libXfont libXfontcache libXft libXi libXinerama libXmu libXpm libXrandr libXrender libXres libXt libXtst libXv libXxf86dga libXxf86misc libXxf86vm libacl libaio libart_lgpl libattr libbdevid-python libbonobo libbonoboui libc-client libcap libdaemon libdhcp libdhcp4client libdhcp6client libdmx libdrm libevent libfontenc libgcc libgcrypt libgcrypt-devel libglade2 libgnome libgnomecanvas libgnomeui libgomp libgpg-error libgpg-error-devel libgssapi libidn libidn-devel libjpeg libmng libnl libnotify libogg libpcap libpng libraw1394 libselinux libselinux-devel libselinux-python libsemanage libsepol libsepol-devel libstdc++ libstdc++-devel libsysfs libtermcap libtermcap-devel libtiff libtiff-devel libtool-ltdl libtool-ltdl-devel libusb libusb-devel libuser libutempter libvolume_id libvorbis libwnck libwvstreams libxkbfile libxml2 libxml2-devel libxml2-python libxslt lksctp-tools lm_sensors logrotate logwatch lsof lvm2
 
yum -y install m2crypto m4 mailcap mailx make man man-pages mc mcstrans mdadm mesa-libGL mesa-libGLU metacity mgetty microcode_ctl mingetty mkbootdisk mkinitrd mkisofs mktemp mlocate mod_perl module-init-tools mtools mtr mysql mysql-devel mysql-server nano nash nc ncurses ncurses-devel neon net-snmp net-snmp-libs net-tools netpbm netpbm-progs newt newt-devel nfs-utils-lib nmap notification-daemon notify-python nscd nspr nss nss-tools nss_db nss_ldap ntp ntsysv numactl oddjob oddjob openjade openldap opensp openssh openssh-clients openssh-server openssl openssl-devel
 
yum -y install pam pam_ccreds pam_krb5 pam_passwdqc pam_pkcs11 pam_smb pango pango-devel paps parted passwd patch pax pciutils pcmciautils pcre pcsc-lite pcsc-lite-libs perl perl-Archive-Tar perl-Archive-Zip perl-BSD-Resource perl-Bit-Vector perl-Carp-Clan perl-Compress-Zlib perl-Convert-ASN1 perl-Crypt-SSLeay perl-DBD-MySQL perl-DBD-Pg perl-DBI perl-Date-Calc perl-DateManip perl-Digest-HMAC perl-Digest-SHA1 perl-HTML-Parser perl-HTML-Tagset perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-IO-String perl-IO-Zlib perl-LDAP perl-NKF perl-Net-DNS perl-Net-IP perl-Net-SSLeay perl-Net-Telnet perl-SGMLSpm perl-Socket6 perl-String-CRC32 perl-URI perl-XML-Dumper perl-XML-Grove perl-XML-LibXML perl-XML-LibXML-Common perl-XML-NamespaceSupport perl-XML-Parser perl-XML-SAX perl-XML-Simple perl-XML-Twig perl-libwww-perl perl-libxml-perl perl-suidperl
 
yum -y install php php-cli php-common php-gd php-imap php-mbstring php-mysql php-pdo php-pear php-pear-DB pinfo pirut pkgconfig pkinit-nss pm-utils policycoreutils popt portmap postfix postgresql-libs ppp prelink procmail procps psacct psmisc pycairo pygobject2 pygtk2 pygtk2 pykickstart pyorbit pyparted python python-elementtree python-numeric python-pyblock python-sqlite python-urlgrabber pyxf86config qt quota rdate rdist readahead readline redhat-artwork redhat-logos redhat-lsb redhat-menus redhat-rpm-config rhpl rhpxl rmt rng-utils rp-pppoe rpm rpm-build rpm-libs rpm-python rsh rsync ruby ruby-libs samba samba-common screen sed selinux-policy selinux-policy-targeted
 
yum -y install sendmail sendmail-cf setarch setup setuptool sgml-common shadow-utils slang slang-devel smartmontools sos sox specspo speex sqlite squashfs-tools startup-notification stunnel subversion sudo symlinks sysfsutils sysklogd syslinux system-config-date system-config-display system-config-keyboard system-config-kickstart system-config-language system-config-network system-config-network system-config-securitylevel system-config-securitylevel-tui system-config-soundcard system-config-users talk tar tcp_wrappers tcpdump tcsh telnet termcap tftp-server time tmpwatch traceroute tree ttmkfdir tzdata udev unix2dos unixODBC unzip usbutils usermode usermode util-linux

Next, I install the other RPM files from the disk:

rpm -Uvh /root/piaf/pbx/c-ares-1.3.2-1.i386.rpm
rpm -Uvh /root/piaf/pbx/ez-ipupdate-3.0.11b8-3.i386.rpm
rpm -Uvh /root/piaf/pbx/flite-1.3-8.fc7.i386.rpm
rpm -Uvh /root/piaf/pbx/flite-devel-1.3-8.fc7.i386.rpm
rpm -Uvh /root/piaf/pbx/iksemel-1.2-13.i386.rpm
rpm -Uvh /root/piaf/pbx/ircd-hybrid-7.2.1-1.i386.rpm
rpm -Uvh /root/piaf/pbx/jpackage-utils-1.7.3-1jpp.2.el5.noarch.rpm
rpm -Uvh /root/piaf/pbx/lame-3.97-1.fc6.rf.i386.rpm
rpm -Uvh /root/piaf/pbx/lha-1.14i-17.i386.rpm
rpm -Uvh /root/piaf/pbx/piafdl-0.1-1.noarch.rpm
rpm -Uvh /root/piaf/pbx/piafxtras-0.1-1.noarch.rpm
rpm -Uvh /root/piaf/pbx/shared-mime-info-0.19-5.el5.i386.rpm
rpm -Uvh /root/piaf/pbx/MySQL-shared-compat-5.0.41-0.rhel4.i386.rpm

Ok, we are ready to install the PBX software now, finally, run this command:

/usr/local/sbin/piafdl 14

The script will ask you if you would like to use option A (to download the PBX load file from the web site; select that option and the PBX load file will download). The installer will run for a while and will reboot your VPS when the installation is finished.

When the system comes back online add your external IP and local network information into the SIP configuration information in the /etc/asterisk/ folder:

vi /etc/asterisk/sip_general_custom.conf

Add these lines to the file where XXX.XXX.XXX.XXX is your public WAN IP address

externip=XXX.XXX.XXX.XXX
localnet=10.0.0.0/24

Now, restart Asterisk:

/usr/local/sbin/amportal restart

Next, browse to your VPS’s WAN IP address (or URL if you have one) and you should see the FreePBX admin center.

RHEL5 init (init.d) script for OpenOffice.org (2.3+)

For a recent project I needed to perform document translations from DOC to PNG which requires an essential intermediate step to PDF. The transformations required us to go to from DOC to PDF which can easily be done very nicely using openoffice 2.3 in a headless configuration. The downside is you need a process running on a machine which you can connect to to make the transformation.

Here is the init.d script for starting up the soffice.bin (soffice) program in a headless mode:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# chkconfig: 345 20 80
# description: init.d script for headless openoffice.org (2.3+ for RHEL5 32bit)
#
# processname: soffice
#
# source function library
. /etc/rc.d/init.d/functions
 
RETVAL=0
SOFFICE_PATH='/usr/lib/openoffice.org/program'
SOFFICE_ARGS='-accept="socket,host=localhost,port=8100;urp" -headless -nofirststartwizard'
SOFFICE_PIDFILE=/var/run/soffice.bin.pid
 
start_soffice() {
       echo -n $"Starting OpenOffice.org"
       $SOFFICE_PATH/soffice.bin $SOFFICE_ARGS >/dev/null 2>&1 &
       [ $? -eq 0 ] && echo_success || echo_failure
       pidof soffice.bin & $SOFFICE_PIDFILE
       echo
}
start() {
       start_soffice
}
stop() {
       echo -n $"Stopping OpenOffice"
       killproc soffice.bin
       echo
}
case "$1" in
       start)
               start
               ;;
       stop)
               stop
               ;;
       restart)
               stop
               start
               ;;
       *)
               echo $"Usage: $0 {start|stop|restart}"
esac

NOTE: in 64bit the lib path has a ‘64′ in it so

SOFFICE_PATH='/usr/lib/openoffice.org/program'

becomes

SOFFICE_PATH='/usr/lib64/openoffice.org/program'