I cant say how much of a fan I am of EPEL made for Fedora but can be used for Centos - It essentially makes Centos usable when building more cutting edge systems in house but still needing Centos's dependability. I know mixing and matching is evil, but this and Dag make great extra's repo's for Centos
EPEL - Repo information
DAG repos
Give them a shot! I'd like to mention dag is great for older linux Versions too :) take a look!
-Mel
Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts
Thursday, March 11, 2010
Tuesday, July 21, 2009
Apt_ctrl - When yum isnt your thing.
Apt_ctrl or Apt Control -
This was really designed to simplify package management by myself. The initial implement came about as a response to those vendors out there whom like to remove yum, but later on even with yum reinstalled... well things just weren't all right. So..? I dev'd out this monster to attempt to bring some sainity. Granite this is not the end to the pain and suffer and yes it only works for Centos 5 atm and will probably only remain in support of centos until the need arises to move to fedora.
Give it a shot you might like it.
#!/bin/bash
### Apt Control ###
#
# Written by L.C. to reduce the suffering of a Centos5 install.
#
# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
rh_file="/etc/redhat-release"
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
fi;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv http://apt.sw.be/redhat/$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd http://mirror.centos.org centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
# we next will install required packages.
apt-get -y install php php-curl php-mysql php-cli postfix mysql-server php-pgsql nano screen mc vixie-cron rkhunter;
This was really designed to simplify package management by myself. The initial implement came about as a response to those vendors out there whom like to remove yum, but later on even with yum reinstalled... well things just weren't all right. So..? I dev'd out this monster to attempt to bring some sainity. Granite this is not the end to the pain and suffer and yes it only works for Centos 5 atm and will probably only remain in support of centos until the need arises to move to fedora.
Give it a shot you might like it.
#!/bin/bash
### Apt Control ###
#
# Written by L.C. to reduce the suffering of a Centos5 install.
#
# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
rh_file="/etc/redhat-release"
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
fi;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv http://apt.sw.be/redhat/$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd http://mirror.centos.org centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
# we next will install required packages.
apt-get -y install php php-curl php-mysql php-cli postfix mysql-server php-pgsql nano screen mc vixie-cron rkhunter;
scron - A cron replacement
This piece below was designed a replacement to cron, because VPS's/VDS's were/are broken and eventually cron dies. So I coded up this installer with ideas and assistance from a co-worker for "Script Cron" or Scron to take the place of the broken vixie-cron and other crons.
Script:
#!/bin/bash
## SCron - When normal cron just isnt working ##
#
# Written by L.C. and R.P.
#
## This section builds all of scrons directories and scron.
echo "Generating directories for scron.. "
mkdir /usr/local/scron ;
chmod 700 /usr/local/scron ;
mkdir /usr/local/scron/jobs ;
chmod 700 /usr/local/scron/jobs ;
echo "Building Scron.. "
cat > /usr/local/scron/scron.sh <<\EOF
#!/bin/bash
#Scron - The 5 minute man
while [ 1 -eq 1 ]; do
for a in /usr/local/scron/jobs/*.sh; do
$a
done
sleep 300
done
EOF
chmod 700 /usr/local/scron/scron.sh ;
chattr +a +i /usr/local/scron/scron.sh ;
echo "Creating custom rc.local.. "
cat > /etc/rc.local < #!/bin/bash
# Scron custom RC.Local
screen -dmS loop /usr/local/scron/scron.sh
exit 0
EOF
## This section is for jobs optionally created upon install.
echo "Generating jobs that will run split_q and fail_restart... "
cat > /usr/local/scron/jobs/split_q.sh < #!/bin/bash
# Script to run split_q.php
php /usr/local/sendstudio/split_q.php
EOF
chmod 700 /usr/local/scron/jobs/split_q.sh
cat > /usr/local/scron/jobs/failed_restart.sh < #!/bin/bash
# Script to run fail_restart.php
php /usr/local/sendstudio/cron/fail_restart.php
EOF
chmod 700 /usr/local/scron/jobs/failed_restart.sh ;
## Patch fail_restart.sh so it will run cli send regardless of
## screen sessions.
cat > /usr/local/sendstudio/cron/fail_restart.sh <<\EOF
#!/bin/bash
screen -ls |grep send > /dev/null
if [[ $? == 0 ]]; then
screen -S send -d -m php /usr/local/sendstudio/clisend.php
fi
EOF
## since we have some custom cron jobs initially installed with
## our production installer we remove them.
echo "copying the maint script.. "
cp /usr/local/sendstudio/maint.sh /usr/local/scron/jobs/
echo "removing old cron.. "
rm -rf /etc/cron.d/obey
## Reboot at the end - optionally you could just run the same
## command in rc.local.
echo "Going down for a reboot"
init 6 ;
Script:
#!/bin/bash
## SCron - When normal cron just isnt working ##
#
# Written by L.C. and R.P.
#
## This section builds all of scrons directories and scron.
echo "Generating directories for scron.. "
mkdir /usr/local/scron ;
chmod 700 /usr/local/scron ;
mkdir /usr/local/scron/jobs ;
chmod 700 /usr/local/scron/jobs ;
echo "Building Scron.. "
cat > /usr/local/scron/scron.sh <<\EOF
#!/bin/bash
#Scron - The 5 minute man
while [ 1 -eq 1 ]; do
for a in /usr/local/scron/jobs/*.sh; do
$a
done
sleep 300
done
EOF
chmod 700 /usr/local/scron/scron.sh ;
chattr +a +i /usr/local/scron/scron.sh ;
echo "Creating custom rc.local.. "
cat > /etc/rc.local <
# Scron custom RC.Local
screen -dmS loop /usr/local/scron/scron.sh
exit 0
EOF
## This section is for jobs optionally created upon install.
echo "Generating jobs that will run split_q and fail_restart... "
cat > /usr/local/scron/jobs/split_q.sh <
# Script to run split_q.php
php /usr/local/sendstudio/split_q.php
EOF
chmod 700 /usr/local/scron/jobs/split_q.sh
cat > /usr/local/scron/jobs/failed_restart.sh <
# Script to run fail_restart.php
php /usr/local/sendstudio/cron/fail_restart.php
EOF
chmod 700 /usr/local/scron/jobs/failed_restart.sh ;
## Patch fail_restart.sh so it will run cli send regardless of
## screen sessions.
cat > /usr/local/sendstudio/cron/fail_restart.sh <<\EOF
#!/bin/bash
screen -ls |grep send > /dev/null
if [[ $? == 0 ]]; then
screen -S send -d -m php /usr/local/sendstudio/clisend.php
fi
EOF
## since we have some custom cron jobs initially installed with
## our production installer we remove them.
echo "copying the maint script.. "
cp /usr/local/sendstudio/maint.sh /usr/local/scron/jobs/
echo "removing old cron.. "
rm -rf /etc/cron.d/obey
## Reboot at the end - optionally you could just run the same
## command in rc.local.
echo "Going down for a reboot"
init 6 ;
Subscribe to:
Posts (Atom)
