Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jakebathman
Created March 14, 2017 14:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jakebathman/0674c20b8eae25f769daf92f4c2df716 to your computer and use it in GitHub Desktop.
Save jakebathman/0674c20b8eae25f769daf92f4c2df716 to your computer and use it in GitHub Desktop.
CentOS box initial setup script
#!/bin/bash
# Base box setup steps
# Do the steps below as root user
sudo su
# The steps below are based on a clean install on
# CentOS 7 (build 1608)
# http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.raw.tar.gz
# Update all existing packages
yum update -y
# Install Yum utilities
yum -y install yum-utils
# Install dev tools
yum groupinstall development -y
# Install vim
yum install vim -y
# Fix vim colors and map escape to clear search highlighting
vimrc_content=":color elflord \nnnoremap <cr> :noh<CR><CR>:<backspace>"; printf "$vimrc_content" >> /usr/share/vim/.vimrc && printf "$vimrc_content" >> ~/.vimrc
# Install PHP 7.0.*
# https://webtatic.com/packages/php70/
## Install repository
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
## Install PHP 7 with common extensions and modules (http://php.net/manual/en/book.opcache.php)
yum install php70w-fpm php70w-opcache php70w-cli php70w-pdo php70w-mysql php70w-mbstring php70w-mcrypt php70w-bcmath php70w-xml php70w-soap php70w-gd php70w-pear -y
# Install MySQL server
## Download the repo
cd /tmp
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update -y
## Install mysql-server
yum install mysql-server -y
systemctl start mysqld
systemctl status mysqld
# Install Git 1.8
yum install git -y
# Install htop
yum install -y htop
# Install wget
yum install -y wget
# Install mlocate
yum install -y mlocate
updatedb
# Install Python 3.5
## Add IUS
yum install https://centos7.iuscommunity.org/ius-release.rpm -y
## Install python
yum install python35u -y
## Install pip
yum install python35u-pip -y
## Install dev tools
yum install python35u-devel -y
##
## Note: you'll need to use python3.5 and pip3.5 commands
## unless you've set up and are inside a virtual environment
##
# Install Nginx 1.8
yum install nginx -y
# Install Supervisord
yum install supervisor -y
# Install Composer
yum install composer -y
# Install Docker
yum install docker -y
# Install wkhtmltopdf
yum install wkhtmltopdf -y
# Install pdftk
yum install python-pdfkit -y
# Update everything again just to make sure
yum update -y
# Test some stuff
## Test docker install
sudo systemctl enable docker.service
systemctl start docker
docker run --rm hello-world
## Test PHP
php -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment