Skip to content

Instantly share code, notes, and snippets.

@DAddYE
Created March 30, 2009 13:37
Show Gist options
  • Save DAddYE/87793 to your computer and use it in GitHub Desktop.
Save DAddYE/87793 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Configurazione iniziale server Fedora 10 64bit
clear
echo "----------------------------------------------------"
echo "--------------Configurazione Fedora 10--------------"
echo "----------------------------------------------------"
echo
echo -n "Vuoi modificare il messaggio di login? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che la tua login sia simile a:"
echo
echo "
__| __|_ ) Fedora 10
_| ( / 32-bit
___|\___|___|
Benvenuto nel awsX della Lipsiasoft s.r.l.
"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/motd
fi
echo -n "Vuoi evitare di scaricare con yum pacchetti non x86_64? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che ci sia:"
echo
echo "exclude=*.i386 *.i586 *.i686"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/yum.conf
fi
echo -n "Vuoi rimuovere i pacchetti non x86_64? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
yum remove *.{i386,i586,i686}
fi
echo -n "Vuoi controllare /etc/hosts? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
vim /etc/hosts
fi
echo -n "Vuoi controllare /etc/sysconfig/network? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che ci sia:"
echo
echo "HOSTNAME=awsX.lipsiasoft.net"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/sysconfig/network
fi
echo -n "Vuoi rendirizzare le mail di root? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che ci sia:"
echo
echo "root: [email protected]"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/aliases
newaliases
fi
echo -n "Vuoi installare l'aggiornamento automatico data? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
yum install ntp -y
chkconfig --levels 235 ntpd on
ntpdate 0.pool.ntp.org
service ntpd start
fi
echo -n "Vuoi installare ruby, httpd, mysqld, sendmail? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
yum install gcc gcc-c++ sendmail httpd-devel httpd apr apr-devel apr-util-devel mysql-server mysql mysql-devel -y
yum install ruby-docs ruby-ri ruby-libs ruby-mode ruby-tcltk ruby-irb ruby-rdoc ruby-devel ImageMagick-devel -y
chkconfig --level 2345 sendmail on
chkconfig --level 2345 mysqld on
chkconfig --level 2345 httpd on
service sendmail start
service mysqld start
service httpd start
fi
echo -n "Vuoi controllare che /etc/httpd/conf/httpd.conf ci sia l'host di default? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che la tua configurazione contenga:"
echo
echo "NameVirtualHost *:80
<VirtualHost *:80>
ServerName _default_
DocumentRoot /var/www/not_found
<Directory /var/www/not_found>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Include /etc/httpd/conf/apps/*.conf"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/httpd/conf/httpd.conf
mkdir /etc/httpd/conf/apps
service httpd restart
fi
echo -n "Vuoi scaricare la index di not found? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
mkdir /var/www/not_found
cd /var/www/not_found
wget http://server1.lipsiasoft.com -O index.html
cd ~
fi
echo -n "Vuoi inserire/resettare una password di root per mysql? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo -n "Inserisci una password di root per mysql: "; read ans
echo -n "Inserisci la vecchia password (Di default è vuota) -> "
/usr/bin/mysqladmin -u root -p password $ans
fi
echo -n "Vuoi installare e configurare apf? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
cd ~
wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz
tar -xvzf apf-current.tar.gz
cd apf*
./install.sh
echo "Controlla che la tua configurazione contenga:"
echo
echo "DEVM=\"0\"
IG_TCP_CPORTS=\"22,80,53,443\"
IG_UDP_CPORTS=\"53\"
EGF=\"0\""
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/apf/conf.apf
chkconfig --level 2345 apf on
service apf start
cd ..
rm -rf apf
fi
echo -n "Vuoi installare e configurare bfd? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
cd ~
wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz
tar -xvzf bfd-current.tar.gz
cd bfd*
./install.sh
echo "Controlla che la tua configurazione contenga:"
echo
echo "ALERT_USR=\"1\""
echo
echo -n "Premi un tasto per continuare"; read ans
vim /usr/local/bfd/conf.bfd
cd ..
rm -rf bfd*
fi
echo -n "Vuoi installare e configurare logwatch? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
yum install logwatch -y
echo "Controlla che la tua configurazione contenga:"
echo
echo "MailFrom = logs
Range = yesterday
Detail = High"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /usr/share/logwatch/default.conf/logwatch.conf
echo "Attendere prego... invio un log di test... non premere alcun tasto! Grazie"
logwatch --detail High --range Today
fi
echo -n "Vuoi installare e configurare logrotate? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
yum install logrotate -y
echo "Controlla che la tua configurazione contenga:"
echo
echo "/var/www/apps/*/log/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/logrotate.d/rails
fi
echo -n "Vuoi verificare le crontab? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che la tua configurazione contenga:"
echo
echo "@hourly find /tmp/ -name \"ruby_sess*\" -cmin +60 -exec rm {} \;
@hourly find /tmp/ -name \"open-uri*\" -cmin +60 -exec rm {} \;
@hourly find /tmp/ -name \"CGI*\" -cmin +600 -exec rm {} \;
@hourly find /tmp/ -name \"stream*\" -cmin +600 -exec rm {} \;"
echo
echo -n "Premi un tasto per continuare"; read ans
crontab -e
fi
echo -n "Vuoi installare e configurare uno script di backup dei database mysql? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Creazione script di backup dei databases"
cd ~
mkdir /mnt/backups
mkdir /mnt/backups/databases
wget http://internap.dl.sourceforge.net/sourceforge/automysqlbackup/automysqlbackup.sh.2.5
echo "Controlla che la tua configurazione contenga:"
echo
echo "USERNAME=root
PASSWORD=tuapassword
DBHOST=localhost
DBNAMES=\"all\"
BACKUPDIR=\"/mnt/backups/databases\"
MAILCONTENT=\"log\"
MAILADDR=\"root\""
echo
echo -n "Premi un tasto per continuare"; read ans
vim automysqlbackup.sh.2.5
mv automysqlbackup.sh.2.5 /etc/cron.daily/automysqlbackup.sh
chmod +x /etc/cron.daily/automysqlbackup.sh
sh /etc/cron.daily/automysqlbackup.sh
fi
echo -n "Vuoi verificare/creare il file di configurazione di rubygems? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
echo "Controlla che la tua configurazione contenga:"
echo
echo "---
:verbose: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com/
:update_sources: true
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
gem: --no-ri --no-rdoc"
echo
echo -n "Premi un tasto per continuare"; read ans
vim ~/.gemrc
fi
echo -n "Vuoi installare rubygems rails, mysql, passenger? (y/n): "; read ans
if [ $ans = "y" -o $ans = "Y" ]; then
cd ~
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar -xvzf rubygems*
cd rubygems*
ruby setup.rb
cd ..
rm -rf rubygems*
gem update
gem install rails
gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
gem install rmagick
gem install passenger
passenger-install-apache2-module
echo
echo "Aggiungi la configurazione per apache fornita da passenger"
echo
echo -n "Premi un tasto per continuare"; read ans
vim /etc/httpd/conf/httpd.conf
service httpd restart
fi
echo
echo "Complimenti... ora se vuoi dai un reboot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment