Fast Uniform Linux Install From Batch File

I used to look after a number of servers and we were forever having grief when they got messed up due to new package installs and testing (used to drive me mad actually….flaming coders).

So quite often they required a good old fashioned cleanup. Well it used to get on my tits that when set up it would take an age and things would always be missing. So I made a batch script that was run just after the CD/DVD base install.

I have copied what I used to use to get up an running fast and pasted it below. Hope it helps or gives you some ideas as to what you can do. If I get any requests I will get the files together as well and post them.

Note: if it racks your system, that’s down to you 🙂

I created a folder called install in the root, made sure I had reoback and phpmyadmin in the right place, with the right name
######

#install and update aptitude
yum install apt
apt-get update

##Edit /etc/apt/sources.list. It should contain the following lines:
echo ‘http://ayo.freshrpms.net/fedora/linux/6/i386/freshrpms’ >> /etc/apt/sources.list
#echo ‘rpm http://ayo.freshrpms.net fedora/linux/4/i386 core updates freshrpms’ >> /etc/apt/sources.list
#echo ‘rpm http://ayo.freshrpms.net fedora/linux/4/i386 tupdates’ >> /etc/apt/sources.list
#echo ‘http://ayo.freshrpms.net fedora/linux/1/i386 core updates freshrpms’ >> /etc/apt/sources.list

#get gpg keys
rpm –import /usr/share/rhn/RPM-GPG-KEY*

#install some common apps
yum install sendmail wget bzip2 unzip zip

#install mysql
yum install mysql mysql-devel mysql-server

#restart mysql server
/etc/init.d/mysqld restart

#set root password
mysqladmin -u root password yourpassword

#install php and apps
apt-get install php php-devel php-gd php-mysql php-pear php-xml php-xmlrpc curl curl-devel

#start apache
/etc/init.d/httpd start

#install webalizer
apt-get install webalizer

#install pcntl fork not done for now, as problems can occur
#rpm -ivh ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/p/ph/phprpms/php-pcntl-4.3.11-2.5.1.i386.rpm

#copy phpmyadmin to /var/www folder
mv phpmyadmin.tar.gz /var/www
cd /var/www

#unzip phpmyadmin
gunzip phpmyadmin.tar.gz

#untar phpmyadmin
tar xvf phpmyadmin.tar

#raname the folder to something sensible
mv phpMyAdmin-2.9.1.1-all-languages-utf-8-only phpmyadmin

#load reoback
mkdir /var/lib/reoback
mkdir /var/lib/reoback/backups
mkdir /var/lib/reoback/data
mkdir /var/lib/reoback/tmp

##update system
yum update

##add admin to sudoers file
echo ‘admin ALL=(ALL)’ >> /etc/sudoers

## add mysql and http to startup
echo ‘service httpd start’ >> /etc/rc.d/rc.local
echo ‘service mysqld start’ >> /etc/rd.d/rc.local

## add alias to phpmyadmin
echo ‘phpmyadmin /var/www/phpmyadmin’ >> /etc/httpd/conf/httpd.conf

## install TOR for anonymous browsing
yum install libevent

rpm -ivH ftp://rpmfind.net/linux/fedora/core/4/i386/os/Fedora/RPMS/openssl097a-0.9.7a-3.i386.rpm

##get latest package from here http://tor.eff.org/download-unix.html.en
rpm -ivH http://tor.eff.org/dist/rpm/tor-0.1.1.26-tor.0.rh4_4.i386.rpm

##install privoxy
rpm -ivH http://kent.dl.sourceforge.net/sourceforge/ijbswa/privoxy-3.0.3-1.6x.i386.rpm

##copy config file and force it with -f
## to access tor use ‘http://localhost:8118’
cp -f config /etc/privoxy

##set yum to update daily since it does not work with FC6
echo ‘#!/bin/sh’ >> /etc/cron.daily/yumupdate
echo ‘/usr/bin/yum -R 10 -e 0 -d 0 -y update yum’ >> /etc/cron.daily/yumupdate
echo ‘/usr/bin/yum -R 120 -e 0 -d 0 -y update’ >> /etc/cron.daily/yumupdate
chmod 755 /etc/cron.daily/yumupdate

##update system one last time
yum -y update

##reboot as all is done! Congrats dude
reboot

###########tasks to do
## ## Go into /var/www/phpmyadmin/libraries/config.defaul.php and change cookie to http and remove host
## test that login to phpmyadmin works
## Add admin user to mysql with select and lock tables
## add admin user to mysql for use with reoback
## edit reoback to backup files and databases
## Drop test database from mysql
##########

2 Comments on “Fast Uniform Linux Install From Batch File

  1. No worries, it can be much slicker than I have done above, but it’s a start.

    Thanks for the comments

    Rich