linuxshell脚本

  • j1_829480
    了解作者
  • 18.4KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-25 06:29
    上传日期
本文件是一个linuxshell脚本可以一键安装linux服务,
脚本.zip
  • 免交互linux 6
  • server.sh
    30.8KB
  • dhcpd.sh
    4.4KB
  • 交互linux6
  • dhcp.sh
    4.2KB
  • all.sh
    19.5KB
内容介绍
#!/bin/bash kss=`head -n 1 /etc/issue|awk '{print $1}'` case $kss in CentOS) [ -e /misc/cd/Packages ] ;; Red) [ -e /misc/cd/Server ] ;; esac case $? in 0) eth=`ifconfig -a|head -1|awk '{print $1}'` mac=`ifconfig $eth|head -1|awk '{print $5}'` echo "# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] DEVICE=$eth BOOTPROTO=dhcp HWADDR=$mac ONBOOT=yes">/etc/sysconfig/network-scripts/ifcfg-$eth service network restart &>/dev/null echo "# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted">/etc/selinux/config setenforce 0 restart iptables stop &>/dev/null chkconfig iptables off if [ $kss = Red ] then echo "[myyum] name=na baseurl=file:///misc/cd enabled=1 gpgcheck=0">/etc/yum.repos.d/rhel-debuginfo.repo yum clean all &>/dev/null fi if [ $kss = CentOS ] then rm -rf /etc/yum.repos.d/* echo "[myyum] name=na baseurl=file:///misc/cd enabled=1 gpgcheck=0">/etc/yum.repos.d/Centos-debuginfo.repo yum clean all &>/dev/null fi yum install samba -y &>/dev/null share=share path=/opt/share [ -e `echo $path` ] if [ $? -ne 0 ] then mkdir -p `echo $path` fi chmod o+wx $path echo "[global] workgroup = workgroup server string = Samba Server Version %v security = user passdb backend = tdbsam load printers = yes cups options = raw [$share] comment = aaaa browseable = yes path = $path writable = yes guest ok = no [homes] comment = Home Directories browseable = no writable = yes [printers] comment = All Printers path = /var/spool/samba browseable = no guest ok = no">/etc/samba/smb.conf sambauser=share useradd $sambauser smpas=share echo $smpas>/root/smpas echo $smpas>>/root/smpas cat /root/smpas|smbpasswd -a $sambauser -s &>/dev/null rm -rf /root/smpas service smb restart &>/dev/null chkconfig smb on yum install vsftpd db4-utils -y &>/dev/null echo "listen=YES listen_address=`ifconfig|grep Bcast|awk '{print $2}'|awk -F: '{print $2}'` listen_port=21 connect_from_port_20=YES #pasv_min_port=2222 #pasv_max_port=2225 write_enable=YES xferlog_enable=YES xferlog_std_format=YES #pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES #max_clients=0 #max_per_ip=0 anonymous_enable=NO #anon_umask=022 #anon_root=/var/ftp #anon_upload_enable=YES #anon_mkdir_write_enable=YES #anon_other_write_enable=YES #anon_max_rate=0 local_enable=YES local_umask=022 #local_root=/var/ftp chroot_local_user=YES #local_max_rate=0 guest_enable=YES guest_username=vuser pam_service_name=vupam user_config_dir=/etc/vsftpd/vuconf">/etc/vsftpd/vsftpd.conf user=wcg password=wcg user2=dx password2=dx echo "$user $password $user2 $password2">/etc/vsftpd/user db_load -T -t hash -f /etc/vsftpd/user /etc/vsftpd/user.db chmod 600 /etc/vsftpd/use* echo "#%PAM-1.0 auth required pam_userdb.so db=/etc/vsftpd/user account required pam_userdb.so db=/etc/vsftpd/user">/etc/pam.d/vupam [ -e /etc/vsftpd/vuconf ] if [ $? -ne 0 ] then mkdir /etc/vsftpd/vuconf fi touch /etc/vsftpd/vuconf/$user touch /etc/vsftpd/vuconf/$user2 echo "anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES">/etc/vsftpd/vuconf/$user [ -e /opt/ftp ] if [ $? -eq 0 ] then rm -rf /opt/ftp fi useradd -d /opt/ftp -s /sbin/nologin vuser chmod -R 755 /opt/ftp service vsftpd restart &>/dev/null chkconfig vsftpd on yum install nfs-utils portmap -y &>/dev/null nfspath=/opt/share rw=192.168.100.0/24 echo "$nfspath ${rw}(rw) 192.168.200.0/24(rw)">/etc/exports mkdir -p $nfspath chmod -R a+wx $nfspath service nfs restart &>/dev/null chkconfig nfs on yum install bind caching-nameserver -y &>/dev/null dname=benet.com hn=www p=`ifconfig|grep Bcast|awk '{print $2}'|awk -F. '{print $3}'` o=`ifconfig|grep Bcast|awk '{print $2}'|awk -F. '{print $2}'` i=`ifconfig|grep Bcast|awk '{print $2}'|awk -F. '{print $1}'|awk -F: '{print $2}'` echo "options { listen-on port 53 { 127.0.0.1;any; }; listen-on-v6 port 53 { ::1; }; directory `echo '"'`/var/named`echo '"'`; dump-file `echo '"'`/var/named/data/cache_dump.db`echo '"'`; statistics-file `echo '"'`/var/named/data/named_stats.txt`echo '"'`; memstatistics-file `echo '"'`/var/named/data/named_mem_stats.txt`echo '"'`; recursion yes; allow-query { localhost;any; }; allow-query-cache { localhost;any; }; # allow-transfer {192.168.100.100;}; # forwarders {202.106.195.68;202.106.46.151;}; }; #zone `echo '"'`.`echo '"'` { #type hint; #file `echo '"'`named.ca`echo '"'`; #}; #zone `echo '"'`lan1.com`echo '"'`{ #type master; #file `echo '"'`lan1.zone`echo '"'`; #}; zone `echo '"'`$dname`echo '"'`{type master; file `echo '"'``echo $dname|awk -F. '{print $1}'`.zone`echo '"'`;}; #zone `echo '"'`lan1.com`echo '"'`{ #type slave; #file `echo '"'`slaves/lan1.zone`echo '"'`; #masters { 192.168.100.1; }; #}; #zone `echo '"'`100.168.192.in-addr.arpa`echo '"'`{ #type master; #file `echo '"'`192.168.100.zone`echo '"'`; #}; zone `echo '"'``echo $p`.`echo $o`.`echo $i`.`echo in`-addr.arpa`echo '"'`{type master; file `echo '"'``echo $p`.`echo $o`.`echo $i`.zone`echo '"'`;}; #zone `echo '"'`100.168.192.in-addr.arpa`echo '"'`{ #type slave; #file `echo '"'`slaves/192.168.100.zone`echo '"'`; #masters { 192.168.100.1; }; #}; #view `echo '"'`LAN`echo '"'` { #match-clients { 192.168.100.0/24; }; #zone `echo '"'`inside.com`echo '"'`{ #type master; #file `echo '"'`inside.zone.lan`echo '"'`; #}; #}; #view `echo '"'`WAN`echo '"'` { #match-clients { any; }; #zone `echo '"'`inside.com`echo '"'`{ #type master; #file `echo '"'`inside.zone.wan`echo '"'`; #}; #};">/etc/named.conf chown named:named /etc/named.conf u=`date +%F|awk -F- '{print $1}'` y=`date +%F|awk -F- '{print $2}'` t=`date +%F|awk -F- '{print $3}'` m=`ifconfig|grep Bcast|awk '{print $2}'|awk -F: '{print $2}'` echo "`echo '$TTL'` 86400 @ IN SOA $dname. root.$dname. ( $u$y${t}00 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN MX 5 mail.$dname. IN NS local.$dname. local IN A `echo $m` ftp IN A `echo $m` mail IN A `echo $m` $hn IN A `echo $m` web IN CNAME $hn.$dname.">/var/named/`echo $dname|awk -F. '{print $1}'`.zone chown named:named /var/named/`echo $dname|awk -F. '{print $1}'`.zone e=`ifconfig|grep Bcast|awk '{print $2}'|awk -F. '{print $4}'` echo "`echo '$TTL'` 86400 @ IN SOA $dname. root.$dname. ( $u$y${t}00 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS local.$dname. $e IN PTR local.$dname. $e IN PTR $hn.$dname. $e IN PTR mail.$dname. $e IN PTR ftp.$dname.">/var/named/`echo $p`.`echo $o`.`echo $i`.zone chown named:named /var/named/`echo $p`.`echo $o`.`echo $i`.zone service named restart &>/dev/null chkconfig named on yum install http* php mysql-server -y &>/dev/null ip=`ifconfig|grep Bcast|awk '{print $2}'|awk -F: '{print $2}'` kl=`echo '"/etc/httpd"'` lk=`echo '"/var/www/html"'` a=`echo '"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""'`
评论
    相关推荐
    • Linux课件
      本课件,浅显易懂,对需要快速入门Linux的人将有极大的帮助。 里面包括在Linux上配置网络的相关知识和Linux的基础知识。
    • Linux教程
      第一章:Linux系统的基本知识 第二章:Linux系统安装 第三章:Linux文本编辑 第四章:Linux常用命令与基本管理 第五章:Linux Shell的使用 第六章:Linux应用程序安装与管理 第七章:Linux核心...
    • linux
      linux 深入了解Linux OS和编程的概念
    • Linux procfs
      Linux procfs相关资料,里面有N个文档。 Linux procfs详解 .doc Linux_proc.pdf linux_proc_文件程序.doc linux_procfs详解.txt linux_proc文件系统.doc Linux中proc文件详解.pdf Proc 源代码分析.pdf proc_访问_...
    • Linux基础
      适合初学者入门,使Linux不在枯燥;高级编程者可以为你打开另外一扇Linux的大门! 让你感受Linux的魅力!
    • linux book
      一本关于Linux 使用 非常详尽的书! 一本关于Linux 使用 非常详尽的书! 一本关于Linux 使用 非常详尽的书!
    • linux linux linux
      linux基础教程linux基础教程linux基础教程linux基础教程
    • linux电子书
      本书是为广大Linux学习者制做的,本书内容基础,语言简短简洁,也节选了一些比较经典而且一定要了解的Linux知识,循序渐进的介绍Linux相关知识,从入门到提高,希望对所有学习Linux的朋友都有帮助。
    • Linux命令
      1、Linux 命令全集 2、Linux 入门常用命令 3、Linux--tar命令 4、Linux实用命令 5、Linux命令集
    • linux
      上海某公司linux机密培训文件