Skip to content

Instantly share code, notes, and snippets.

@th0j
Last active April 27, 2017 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save th0j/37028465ed58138ee8453c03c0c511d8 to your computer and use it in GitHub Desktop.
Save th0j/37028465ed58138ee8453c03c0c511d8 to your computer and use it in GitHub Desktop.
install_server_centos
echo 'UPDATE YUM'
yum update -y
yum upgrade -y
yum install -y wget
echo 'DISABLE FIREWALL'
service iptables stop
chkconfig iptables off
echo 'INSTALL JAVA'
cd /home/vagrant
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz
tar -xzf jdk-8u112-linux-x64.tar.gz
cd /home/vagrant/jdk1.8.0_112
alternatives --install /usr/bin/java java /home/vagrant/jdk1.8.0_112/bin/java 2
alternatives --config java <<< '1'
sh -c 'echo "export JAVA_HOME=/home/vagrant/jdk1.8.0_112" >> /home/vagrant/.bash_profile'
sh -c 'echo "export JRE_HOME=/home/vagrant/jdk1.8.0_112/jre" >> /home/vagrant/.bash_profile'
sh -c 'echo "export PATH=$PATH:/home/vagrant/jdk1.8.0_112/bin:/home/vagrant/jdk1.8.0_112/jre/bin" >> /home/vagrant/.bash_profile'
source /home/vagrant/.bash_profile
cd ../
rm -rf jdk-8u112-linux-x64.tar.gz
echo 'CREATE KEY'
source /home/vagrant/.bash_profile
cd /vagrant
if [ "$(ls | grep 'keystore.p12')" != "keystore.p12" ]; then
keytool -genkey -alias tomcat \
-storetype PKCS12 -keyalg RSA -keysize 2048 \
-keystore keystore.p12 -validity 3650 << EOF
123456\n123456\ndevel\ndevel\nHamee\nTokyo\n\n\ny\nEOF\n
chown -R vagrant:vagrant keystore.p12
fi
# --- MySQL 5.6.*(http://ips.nekotype.com/3420/)
echo 'INSTALL MYSQL'
cd /home/vagrant
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum install -y mysql-server
# --- Date -> MySQL date config
sed "s/\[mysqld\]/[mysqld]\ndefault-time-zone='+9:00'/" /etc/my.cnf -i
/etc/init.d/mysqld start
mysql -uroot < /vagrant/vagrant/script.sql
mysql -uroot -e "CREATE DATABASE check_connection"
mysql -uroot -e "CREATE USER 'devel'@'localhost' IDENTIFIED BY 'devel';"
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'devel'@'localhost';"
mysql -uroot -e "FLUSH PRIVILEGES;"
echo 'SETUP TIMEZONE'
cp /usr/share/zoneinfo/Japan /etc/localtime
sh -c "echo 'ZONE=\"Asia/Tokyo\"' > /etc/sysconfig/clock"
yum install -y ntpdate.x86_64
ntpdate ntp.nict.jp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment