Slackware kurulum sonrası ayarları
From Lapis Wiki
[değiştir]
Giriş
Slackware'i kurduktan sonra bir çok uygulamayı veya sistem temelli dosyaları yapılandırmanız gerekebilir. Bunun için yazılmış güzel bir betik buldum. Yapmanız gereken, bu betiği kaıyt edip (örneğin slack.sh ismi ile) daha sonra konsolda
sh slack.sh
komutu ile başlatmanız. Vakit bulduğumda Türkçeye çevireceğim.
[değiştir]
Betik
| Kod: slack.sh |
#!/bin/sh
#
# This script was written by Pablo Graziano of Compugenic Solutions (copyright 2006)
# The purpose is to help perform common configuration tasks on a slackware 10.2 system.
# Absolutely NO warranty (use at your own risk)
#
# Any errors or bugs should be emailed to bugs AT compugenic d0t c0m
# Thanks for playing, and enjoy.
#
## Update 2006-03-16
## Added VSFTPD options (one to enable it, another to configure sane settings).
##
opening()
{
clear
echo " Welcome to Pablo Graziano's "
echo " Slackware post-install setup script"
echo -e "\n\n\n"
}
init_searchdb()
{
echo ""
echo "Creating & updating search database [backgrounding]"
sleep 1
touch /var/lib/slocate/slocate.db
nohup updatedb& 1>/dev/null 2>/dev/null
}
init_cups()
{
echo ""
echo "Enabling CUPS print server"
sleep 1
chmod 755 /etc/rc.d/rc.cups
/etc/rc.d/rc.cups start
echo "*******************************************"
echo "CUPS server is enabled and running. To access the CUPS"
echo "server, open the following web page in a browser and "
echo "log in as root."
echo "http://localhost:631"
echo "*******************************************"
echo ""
echo -n "Press ENTER to continue."
read junk
}
#clear
#if grep -q '^[ \t]*bitmap' /etc/lilo.conf; then
# echo "*******************************************"
# echo "The lilo graphics bitmap is already enabled."
# echo "*******************************************"
# echo ""
# echo -n "Press ENTER to continue"
# read junk
#else
# echo "*******************************************"
# echo "Add graphics to the lilo bootloader [y/n] ? "
# echo "*******************************************"
# echo ""
# echo -n "> "
# unset answer
# read answer
# if [ $answer = y ]; then
# echo "Configuring lilo with graphical boot prompt" && sleep 1
# if [ ! -e /boot/logo64a.bmp ]; then
# cp /usr/doc/lilo*/sample/logo64a.bmp /boot
# cat /etc/lilo.conf | sed -e '/^message/d;s_^vga.*_&\nmap = /boot/map-bmp\ninstall=/boot/boot-bmp.b\nbitmap = /boot/logo64a.bmp\nbmp-colors = 15,,0;5,,15\nbmp-table = 59,5,1,18,\nbmp-timer= 66,18,6,8,0_' > /tmp/lilo.conf
# mv /etc/lilo.conf{,.bak}
# mv /tmp/lilo.conf /etc/lilo.conf && chmod 644 /etc/lilo.conf && chown root.root /etc/lilo.conf
# fi
# fi
#echo ""
#echo "Added graphical lilo to configuration file."
#echo "To complete the configuration, inspect /etc/lilo.conf"
#echo "and run /sbin/lilo as root to apply changes."
#echo ""
#echo -n "Press ENTER to continue"
#read junk
#fi
init_alsa()
{
alsaconf
}
init_proftpd()
{
clear
if grep -q '^ftp' /etc/inetd.conf; then # If ftp enabled, disable it first
echo "Disabling `grep '^ftp' /etc/inetd.conf|awk '{print $7}'` FTP server"
sleep 1
sed -e '/^ftp/s/^/#/' /etc/inetd.conf > /tmp/inetd.conf
mv /tmp/inetd.conf /etc/inetd.conf
fi
echo "Enabling proftpd FTP server" && sleep 1
sed -e '/proftpd$/s/#//' /etc/inetd.conf > /tmp/inetd.conf
mv /etc/inetd.conf{,.bak}
mv /tmp/inetd.conf /etc/inetd.conf
chmod 644 /etc/inetd.conf
}
init_vsftpd()
{
clear
if grep -q '^ftp' /etc/inetd.conf; then # If ftp enabled, disable it first
echo "Disabling `grep '^ftp' /etc/inetd.conf|awk '{print $7}'` FTP server"
sleep 1
sed -e '/^ftp/s/^/#/' /etc/inetd.conf > /tmp/inetd.conf
mv /tmp/inetd.conf /etc/inetd.conf
fi
echo "Enabling vsftpd FTP server" && sleep 1
sed -e '/vsftpd$/s/#//' /etc/inetd.conf > /tmp/inetd.conf
mv /etc/inetd.conf{,.bak}
mv /tmp/inetd.conf /etc/inetd.conf
chmod 644 /etc/inetd.conf
}
config_vsftpd()
{
echo "Configuring vfstpd to:"
echo " a. Disable anonymous access."
echo " b. Enable only valid users."
echo " c. Enabling sane settings."
sleep 3
if sed -ne '1p' /etc/vsftpd.conf |grep -q Example ; then
mv /etc/vsftpd.conf /etc/vsftpd.conf.orig
fi
cat > /etc/vsftpd.conf << EOF
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=077
anon_upload_enable=NO
anon_mkdir_write_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
idle_session_timeout=600
data_connection_timeout=120
nopriv_user=ftp
async_abor_enable=YES
ftpd_banner=Slackbox FTP
pasv_max_port=2002
EOF
}
init_pop3()
{
if ! grep -q '^pop' /etc/inetd.conf; then
echo ""
echo "Enabling POP3 server" && sleep 1
sed -e '/popa3d$/s/#//' /etc/inetd.conf > /tmp/inetd.conf
mv /etc/inetd.conf{,.bak}
mv /tmp/inetd.conf /etc/inetd.conf && chmod 644 /etc/inetd.conf
else
echo "*******************************************"
echo "POP3 support already enabled in /etc/inetd.conf."
echo "*******************************************"
echo ""
echo -n "Press ENTER to continue."
read junk
fi
}
init_imap()
{
if ! grep -q '^imap' /etc/inetd.conf; then
echo "Enabling IMAP server..."
sleep 1
sed -e '/imapd$/s/#//' /etc/inetd.conf > /tmp/inetd.conf
mv /etc/inetd.conf{,.bak}
mv /tmp/inetd.conf /etc/inetd.conf && chmod 644 /etc/inetd.conf
else
echo "*******************************************"
echo "IMAP support already enabled in /etc/inetd.conf."
echo "*******************************************"
echo ""
echo -n "Press ENTER to continue."
read junk
fi
}
init_inetd()
{
echo "Restarting inetd server..."
sleep 1
kill -HUP `pidof inetd`
}
init_apache()
{
## Set index extensions
echo -ne "\nEnabling index file extensions *.(htm|html|shtml|shtm|php)..." && sleep 1
sed -e '/^[ \t]*DirectoryIndex.*/s/.*/& index.htm index.shtml index.shtm index.php/' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /etc/apache/httpd.conf{,.bak}
mv /tmp/httpd.conf /etc/apache/httpd.conf
## Set ServerName
echo -en "\nEnter the full domain-name of your webserver: "
read SERVERNAME
echo -ne "Setting ServerName to $SERVERNAME..." && sleep 1
sed -e '/^#*ServerName /s/.*/ServerName '$SERVERNAME'/' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /tmp/httpd.conf /etc/apache/httpd.conf
## Set HostnameLookups
echo -en "\nEnabling HostnameLookups directive..." && sleep 1
sed -e '/^HostnameLookups/s/.*/HostnameLookups On/' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /tmp/httpd.conf /etc/apache/httpd.conf && chmod 644 /etc/apache/httpd.conf
## Set CustomLog
echo -en "\nEnabling CustomLog directive..." && sleep 1
sed -e '/^#CustomLog.*access_log/s_.*_CustomLog /var/log/apache/access.log combined_' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /tmp/httpd.conf /etc/apache/httpd.conf
## Disable ServerSignature
echo -en "\nDisabling ServerSignature directive... " && sleep 1
sed -e '/^ServerSignature/s/[Oo]n/Off/' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /tmp/httpd.conf /etc/apache/httpd.conf
## Enable SSL
echo -en "\nEnabling SSL..." && sleep 1
sed -e '/^#Include.*mod_ssl.conf/s/#//' /etc/apache/httpd.conf > /tmp/httpd.conf
cp /etc/apache/ssl.crt/snakeoil-rsa.crt /etc/apache/ssl.crt/server.crt
cp /etc/apache/ssl.key/snakeoil-rsa.key /etc/apache/ssl.key/server.key
mv /tmp/httpd.conf /etc/apache/httpd.conf
sed -e 's/apachectl start /apachectl startssl /' /etc/rc.d/rc.httpd > /tmp/rc.httpd
mv /tmp/rc.httpd /etc/rc.d/rc.httpd
chmod 755 /etc/rc.d/rc.httpd
## Enable PHP
echo -en "\nEnabling PHP..." && sleep 1
sed -e '/^#Include.*php/s/#//' /etc/apache/httpd.conf > /tmp/httpd.conf
mv /tmp/httpd.conf /etc/apache/httpd.conf
## Restart apache
echo -en "\nRestarting Apache...\n"
sleep 1
/etc/rc.d/rc.httpd restart
echo -e "\n\n\n\n\n"
echo "*******************************"
echo "You now Apache running with SSL & PHP support."
echo ""
echo "To test SSL, open a browser to URL:"
echo "https://<servername>"
echo ""
echo "To test PHP, open a browser to URL:"
echo "http://<servername>/info.php "
echo ""
echo "If you're on the webserver, replace '<servername> with 'localhost'."
echo ""
echo "*******************************"
echo "<?php" > /var/www/htdocs/info.php
echo "phpinfo();" >> /var/www/htdocs/info.php
echo "?>" >> /var/www/htdocs/info.php
echo ""
echo "Press ENTER to continue: "
read junk
}
init_mysql()
{
echo "Enabling MySQL server..."
chmod 755 /etc/rc.d/rc.mysqld
if [ ! -d /var/lib/mysql/mysql ]; then
echo "Creating initial MySql system tables..."
mysql_install_db
chown -R mysql.mysql /var/lib/mysql
fi
echo -n "Allow network access to MySql server [y/n]:"
unset answer
read answer
if [ $answer = y ]; then
if grep -q '^SKIP.*networking' /etc/rc.d/rc.mysqld; then
sed -e '/^SKIP.*networking/s/^/#/' /etc/rc.d/rc.mysqld > /tmp/rc.mysqld
mv /tmp/rc.mysqld /etc/rc.d/rc.mysqld && chmod 755 /etc/rc.d/rc.mysqld
fi
fi
if ! ps axc|grep mysqld 1>/dev/null 2>/dev/null; then
echo "Starting MySql..."
mysqld_safe &
sleep 1
else
echo "Restarting MySql..."
/etc/rc.d/rc.mysqld restart
sleep 1
fi
}
init_postfix()
{
clear
echo "*******************************************"
echo "Install Postfix mail server [y/n] ? "
echo "*******************************************"
echo -n "> "
unset answer
read answer
if [ $answer = y ]; then
# remove sendmail if installed
for pkg in $(find /var/log/packages -name 'sendmail*'); do
echo "Removing package $(basename $pkg)" && sleep 3
echo "5 seconds to press ENTER to cancel"
if read -t 5 junk; then
exit 1
fi
removepkg $(basename $pkg)
done
# download postfix slackpack
echo "Downloading postfix slackpack"
cd /tmp
wget http://www.compugenic.com/pub/slackpacks/postfix-2.2.9-i486-1stb.tgz
# install postfix slackpack
echo "Installing postfix slackpack"
installpkg /tmp/postfix-2.2.9-i486-1stb.tgz
# make startup script executable
if [ -e /etc/rc.d/rc.postfix ]; then
echo "Making /etc/rc.d/rc.postfix executable"
chmod 755 /etc/rc.d/rc.postfix
else
echo "Warning: /etc/rc.d/rc.postfix startup script non-existent"
fi
# start postfix system
echo "Starting postfix mail server"
/etc/rc.d/rc.postfix start 2>/dev/null || postfix start
fi
}
config_postfix()
{
clear
echo "*******************************************"
echo "Configure Postfix now [y/n] ? "
echo "*******************************************"
echo -n "> "
unset answer
read answer
if [ "$answer" = y ]; then
clear
echo "*******************************************"
echo "What domain name to use in outbound email? "
echo "*******************************************"
echo -n "> "
read OUTBOUND_DOMAIN
clear
echo "*******************************************"
echo "What domains to receive mail for? "
echo ""
echo "NOTE: These domains will be delivered locally"
echo "to this email server, and not forwarded"
echo "to another mail server."
echo "*******************************************"
echo -n "> "
read RECEIVE_DOMAINS
clear
echo "*******************************************"
echo "What clients to relay mail from? "
echo ""
echo "Note:"
echo "Typing \"host\" means to only relay mail originating from this machine."
echo ""
echo "Typing \"subnet\" means to relay mail originating from any host on same subnet(s)."
echo ""
echo "Typing an ip network address means to relay mail originating from any host whose"
echo "ip address matches the given ip network address ranges (cidr notation)"
echo ""
echo "*Separate multiple addresses with a space."
echo ""
echo "example: 192.168.1.0/24"
echo "example: 10.8.0.0/8 192.168.0.0/24"
echo ""
echo "*******************************************"
echo -n "> "
read RELAY_FROM
clear
echo "*******************************************"
echo "What destination to relay mail to? "
echo ""
echo "If this machine is relaying mail for 'other' domains,"
echo "then type those domain names in now, separated by spaces."
echo ""
echo "Otherwise, just press ENTER"
echo ""
echo "example: domain1.com domain2.com domain3.com"
echo "*******************************************"
echo -n "> "
read RELAY_DOMAINS
clear
echo "*******************************************"
echo "If this mailserver delivers outgoing email"
echo "directly via the Internet, just press ENTER."
echo ""
echo "But if this mailserver should forward all outgoing"
echo "email to another mail server for delivery, then "
echo "type that machine's ip address now."
echo ""
echo "example: 192.168.0.7"
echo ""
echo "*******************************************"
echo -n "> "
read RELAYHOST
# strip main.cf of uselessness
cp /etc/postfix/main.cf{,.orig}
sed -e '/^$/d;/^#/d;/^[ \t]*$/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
if [ -n "$OUTBOUND_DOMAIN" ]; then
sed -e '/^[ \t]*myorigin/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
echo "myorigin = $OUTBOUND_DOMAIN" >> /etc/postfix/main.cf
fi
if [ -n "$RECEIVE_DOMAINS" ]; then
sed -e '/^[ \t]*mydestination/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
echo "mydestination = \$myhostname localhost.\$myhostname localhost $RECEIVE_DOMAINS" >> /etc/postfix/main.cf
fi
if [ -n "$RELAY_FROM" ]; then
sed -e '/^[ \t]*mynetworks/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
if [ "$RELAY_FROM" = host ]; then
echo "mynetworks_style = host" >> /etc/postfix/main.cf
elif [ "$RELAY_FROM" = subnet ]; then
echo "mynetworks_style = subnet" >> /etc/postfix/main.cf
else
echo "mynetworks = 127.0.0.0/8 $RELAY_FROM" >> /etc/postfix/main.cf
fi
fi
sed -e '/^[ \t]*relay_domains/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
if [ -n "$RELAY_DOMAINS" ]; then
echo "relay_domains = $RELAY_DOMAINS" >> /etc/postfix/main.cf
else
echo "relay_domains = \$mydestination" >> /etc/postfix/main.cf
fi
if [ -n "$RELAYHOST" ]; then
sed -e '/^[ \t]*relayhost/d' /etc/postfix/main.cf > /tmp/main.cf && mv /tmp/main.cf /etc/postfix/main.cf
echo "relayhost = $RELAYHOST" >> /etc/postfix/main.cf
fi
echo "Restarting Postfix mail system" && sleep 1
/etc/rc.d/rc.postfix restart
fi
}
init_user()
{
echo -n "Enter username: "
read UN
useradd -m $UN
echo "Now to set the password for $UN"
passwd $UN
}
closing()
{
clear
echo "*******************************************"
echo "Congratulations!"
echo ""
echo "You now have a shiny new slackware linux installation."
echo "Remember to send any bugs or suggestions to bugs@compugenic.com"
echo ""
echo "*******************************************"
echo ""
echo -n "Press ENTER to exit."
read junk
echo ""
}
showmenu()
{
clear
echo "*******************************************"
echo "Select an option"
echo ""
echo "1. Initialize search database."
echo "2. Enable CUPS printing system."
echo "3. Configure ALSA sound system."
echo "4. Enable proftpd FTP server."
echo "5. Enable POP3 server."
echo "6. Enable IMAP server."
echo "7. Enable Apache server."
echo "8. Enable MySQL database server."
echo "9. Enable Postfix SMTP server."
echo "10. Configure Postfix SMTP server."
echo "11. Create new user account."
echo "12. Enable vsftpd FTP server."
echo "13. Configure vfstpd to:"
echo " a. Disable anonymous access."
echo " b. Enable only valid users."
echo " c. Enabling sane settings."
echo ""
echo "q for quit."
echo "*******************************************"
echo ""
echo -n "> "
read selection
}
opening
showmenu
while true; do
case "$selection" in
1) clear
init_searchdb ;;
2) clear
init_cups ;;
3) clear
init_alsa ;;
4) clear
init_proftpd
init_inetd ;;
5) clear
init_pop3
init_inetd ;;
6) clear
init_imap
init_inetd ;;
7) clear
init_apache ;;
8) clear
init_mysql ;;
9) clear
init_postfix ;;
10) clear
config_postfix ;;
11) clear
init_user ;;
12) clear
init_vsftpd
init_inetd ;;
13) clear
config_vsftpd
init_inetd ;;
q) clear
closing
exit 0 ;;
*) clear
echo "That was not an option"
exit 1 ;;
esac
showmenu
done
|
