大家好,有人可以指导我或重写我的剧本吗?我每次重新安装时手动输入此代码。 我只想在一个脚本文件中完成所有这些
yum update -y
yum install httpd -y
service httpd start
yum install mysql-server -y && service mysqld start && mysql_secure_installation
yum install php php-mysql -y && service httpd restart
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum check-update && yum install phpMyAdmin -y
vi /etc/httpd/conf.d/phpMyAdmin.conf (Will edit some of line)
yum install git -y && yum install gcc make mysql mysql-devel mysql-server pcre-devel zlib-devel && yum -y install dos2unix gdb nano screen unzip wget zip
yum -y groupinstall Desktop && yum -y install tigervnc-server pixman pixman-devel libXfont
vncpasswd
vi /etc/sysconfig/vncservers
(Will write this on the bottom of vncservers)
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1100x768"
yum -y install xterm && yum -y install subversion && yum install gnome-utils -y && yum -y install nautilus-open-terminal
service vncserver start
chkconfig httpd on && chkconfig mysqld on && chkconfig vncserver on
reboot
===== 有没有人可以帮我清理并把它放在1个文件中?
答案 0 :(得分:0)
在您选择的某个目录中执行touch [script_name].sh
,然后在脚本中输入以下内容
#!/bin/bash
#if not sudo or root yum fails
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
yum update -y
yum install httpd -y
service httpd start
yum install mysql-server -y && service mysqld start && mysql_secure_installation
yum install php php-mysql -y && service httpd restart
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum check-update && yum install phpMyAdmin -y
sed -i '24s/Deny from All/Allow from All/' /etc/httpd/conf.d/phpMyAdmin.conf
yum install git -y && yum install gcc make mysql mysql-devel mysql-server pcre-devel zlib-devel && yum -y install dos2unix gdb nano screen unzip wget zip
yum -y groupinstall Desktop && yum -y install tigervnc-server pixman pixman-devel libXfont
vncpasswd
echo VNCSERVERS="1:root" >> /etc/sysconfig/vncservers
echo VNCSERVERARGS[1]="-geometry 1100x768" >> /etc/sysconfig/vncservers
yum -y install xterm && yum -y install subversion && yum install gnome-utils -y && yum -y install nautilus-open-terminal
service vncserver start
chkconfig httpd on && chkconfig mysqld on && chkconfig vncserver on
echo rebooting computer
sleep 5
reboot
完成后退出文本编辑器并运行命令chmod +x /scriptpath/[script_name].sh
,然后cd
运行到包含脚本的目录并运行./[script_name].sh
。