2016-04-14 13 views
-6

Hallo Leute kann mich jemand führen oder mein Skript neu schreiben? Nun, ich tippe diesen Code bei jeder Neuinstallation manuell ein. ich will das alles nur in nur 1 Skript-Datei machenRichtiger Weg, dies zu einem Shell-Skript zu machen

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 

===== Gibt es jemand kann mir helfen, zu bereinigen, und dass nur in 1 Datei setzen?

+7

Legen Sie es in eine Datei. Mach es ausführbar. Starte es. – PeeHaa

Antwort

0

in ein Verzeichnis Ihrer Wahl geben Sie touch [script_name].sh dann folgendes in das Skript

#!/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 

Danach beenden Sie den Texteditor erfolgt und führen Sie den Befehl chmod +x /scriptpath/[script_name].sh und dann cd in das Verzeichnis, das Skript, und führen Sie enthält ./[script_name].sh.

+0

Hallo, danke für die Antwort. in /etc/httpd/conf.d/phpMyAdmin.conf würde ich die Zeile 24, die "Von allen verweigern" auf "Von allen erlauben", bearbeiten, welchen Code soll ich in das Skript schreiben? – Ranz

+0

@Ranz bearbeitet, so dass es in Zeile 24 geht und Inline Deny von All mit Allow von All ersetzt – jgr208

Verwandte Themen