Last active
April 17, 2018 02:35
-
-
Save casjay/f689b9e7e24a83e19d611bd0e973dbcf to your computer and use it in GitHub Desktop.
Script to Install CentOS Server on a system with one ethernet card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install -y wget net-tools e2fsprogs http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/v/vnstat-1.15-2.el7.x86_64.rpm | |
systemctl enable vnstat && systemctl start vnstat | |
wget casjay.us/vm-settings/base-eth.tar.gz -O /tmp/base-eth.tar.gz | |
mkdir -p /tmp/base && tar xfvz /tmp/base-eth.tar.gz -C /tmp/base && cp -Rfv /tmp/base/root/.bashrc /root/ && exit | |
cp -Rfv --no-preserve=mode,ownership /tmp/base/* / && chattr +i /etc/resolv.conf | |
timedatectl set-timezone America/New_York | |
sed -i "s#myserverdomainname#$(echo $HOSTNAME)#g" /etc/sysconfig/network | |
sed -i "s#mydomain#$(echo $HOSTNAME |awk -F. '{$1="";OFS="." ; print $0}' | sed 's/^.//')#g" /etc/sysconfig/network | |
domainname $(hostname -f |awk -F. '{$1="";OFS="." ; print $0}' | sed 's/^.//') && echo "kernel.domainname=$(domainname)" >> /etc/sysctl.conf | |
rpm -ev --nodeps chrony cronie-anacron sendmail sendmail-cf ; yum remove -y chrony libvirt* virt* | |
rm -Rfv /etc/tuned* /etc/chrony* anaconda-ks.cfg /var/log/anaconda | |
reboot | |
yum clean all && yum update -y | |
reboot | |
yum install -y $(cat rpms-default.txt ) | |
rm -Rfv /etc/named* /var/named/* /etc/ntp* /etc/cron*/0* /etc/cron*/dailyjobs /var/ftp/uploads /etc/httpd/conf.d/ssl.conf | |
wget casjay.us/vm-settings/default-eth.tar.gz -O /tmp/default-eth.tar.gz | |
mkdir -p /tmp/default && tar xfvz /tmp/default-eth.tar.gz -C /tmp/default && cp -Rfv --no-preserve=mode,ownership /tmp/default/* / | |
mkdir -p /var/log/named && chown -Rfv named:named /etc/named* /var/named /var/log/named && chown -Rfv apache:apache /var/www /usr/share/httpd && chmod 664 /etc/cron.d/* | |
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt | |
munin-node-configure --shell | sh | |
git clone https://github.com/CasjaysDev/system-scripts.git /tmp/system-scripts | |
rm -Rf /tmp/system-scripts/doc /tmp/system-scripts/CODE_OF_CONDUCT.md /tmp/system-scripts/LICENSE /tmp/system-scripts/README.md /tmp/system-scripts/.git /tmp/system-scripts/version.txt | |
cp -Rf /tmp/system-scripts/* / | |
find /root/bin /etc/casjaysdev /usr/share/system-scripts -type f -iname "*.sh" -exec chmod +x {} \; | |
chmod 755 /etc/sysconfig/system-scripts.sh /etc/rc.d/init.d/systemmail | |
systemctl enable munin-node httpd named postfix uptimed php-fpm netdata fail2ban shorewall shorewall6 proftpd rsyslog ntpd | |
systemctl disable firewalld auditd kdump | |
rm -Rfv /tmp/*.tar.gz /tmp/base /tmp/default | |
ifconfig | |
echo "Edit and run /root/bin/changeip.sh" | |
#vim /root/bin/changeip.sh | |
/root/bin/changeip.sh | |
echo "run certbot certonly --dns-rfc2136 --dns-rfc2136-credentials /etc/named/certbot-update.conf -d $(domainname)" | |
echo "run certbot -a webroot -i apache -w /var/www/casjay -d $(domainname) -d *.$(domainname)" | |
systemctl reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment