Minimal init initialization script to install CentOS

Source: Internet
Author: User
Tags gpg

#!/bin/bash#this script is appropriate forMinimize installation system CentOS or Linux6. x (This script is suitable for minimizing the installation of the 6.x version of the system) #you have alreadyInstallThe osread-P"pleases input hostname for Linux:"Hnamesed-I."/hostname/s/localhost\.localdomain/$hname/g"/etc/sysconfig/Networksed-I.'s/enforcing/disabled/g'/etc/selinux/config#set IP addressread-P"Please input IP to host (like 192.168.1.1):"IP Read-P"Please input gataway IP for host:"Gateread-P"Please input the DNS IP for host:"dnseth_conf=/etc/sysconfig/network-scripts/ifcfg-eth0sed-i-e'/ipaddr/d'-E'/netmask/d'$eth _confsed-I.'/nm_controlled/s/yes/no/g'$eth _confsed-I.'/onboot/s/no/yes/g'$eth _confsed-I.'$a bootproto=static'$eth _conf#Cat>> $eth _conf <<eof#ipaddr=$ip #netmask=255.255.255.0#GATEWAY=$gate #dns1=$dns #eofEcho-E"ipaddr= $ip \nnetmask=255.255.255.0">>$eth _confEcho-E"gateway= $gate \ndns1= $dns">>$eth _confsed-I.'/^$/d'$eth _conf#ifYou host can serf internet us set up this yum (if your computer can surf the Internet, we build such a yum,centos without building, there is a direct Yum source)CD/etc/Yum. repos.d/RM-RF *. RepoCat>>/etc/Yum. Repos.d/my.repo <<Eof[base]name=Centos6baseurl=http://mirrors.163.com/centos/$releasever/os/$basearchgpgecheck=1Gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-6EOFYum Clean All#ifYou host cannot serf Internet set up the Yum (computer does not work on the internet Yum so build, CentOS and Redhat are suitable)Mount/dev/cdrom/Mediased-I.'$a \/dev\/cdrom \/media iso9660 defaults 0 0'/etc/fstab#Echo "/dev/cdrom/media iso9660 defaults 0 0">>/etc/FSTABCD/etc/Yum. repos.d/RM-RF *. RepoCat>>/etc/Yum. Repos.d/iso.repo <<Eof[centos]name=Centosbaseurl=file:///media/gpgcheck=1enabled=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6EOFYum Clean AllEcho "# # #restart Network card#####"Service Network Restart#set up (VIM editor)Yum-YInstallvim#set up (open packages and development tools)Yum-Y Groupinstall"Development" "Development Tools"#set Up (graphical desktop) These packages are a bit more, and it's recommended to build a local yum installation #Yum-Y Groupinstall"Desktop" "X Window System"Yum-Y Groupinstall"Desktop" "Desktop Debugging and Performance Tools" "X Window System" "Desktop Platform" "Desktop Platform Development" "General Purpose Desktop" "Remote Desktop Clients"Init5# (set Vncserver)Yum-YInstalltigervnc-server.x86_64Echo "# # # # #please input vncserver passwd########"Vncserversed-I.'s/xterm/#xterm/g'/root/.vnc/Xstartupsed-I.'s/twm/#twm/g'/root/.vnc/XstartupEcho "Gnome-session &">>/root/.vnc/XstartupCat>>/etc/sysconfig/vncservers <<EOF vncservers="1:root"vncserverargs[1]="-geometry 1024x768-nolisten TCP"eofservice vncserver restartvncserver-Kill:1Vncserver:1Chkconfig--Add Vncserverchkconfig--level *vncserver onservice sshd RestartEcho "==========it is ok==========="# (after doing this your Linux server can either SSH up or use VNC to connect to the graphical GUI of Linux)

Minimal init initialization script to install CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.