-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCentos7-install-base.sh
103 lines (79 loc) · 3.57 KB
/
Centos7-install-base.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#/!/bin/bash
# get some repos
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
# install apache
yum install nano wget httpd -y
# get latest mysql
# yum install -y http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# yum install -y mysql-community-server
# systemctl enable mysqld.service
# /bin/systemctl start mysqld.service
yum update -y
yum install -y --enablerepo=remi-php70 php php-apcu php-fpm php-opcache php-cli php-common php-gd php-mbstring php-mcrypt php-pdo php-xml php-mysqlnd
# varnish
# rpm --nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el7.rpm
# yum install -y varnish
# VARNISH
# cat varnish/default.vcl > /etc/varnish/default.vcl
# cat varnish/varnish.params > /etc/varnish/varnish.params
# Varnish can listen
# sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf
# PHP
# The first pool
cat php/www.conf > /etc/php-fpm.d/www.conf
#opcache settings
cat php/opcache.ini > /etc/php.d/10-opcache.ini
#disable mod_php
cat php/php.conf > /etc/httpd/conf.d/php.conf
#disable some un-needed modules.
cat modules/00-base.conf > /etc/httpd/conf.modules.d/00-base.conf
cat modules/00-dav.conf > /etc/httpd/conf.modules.d/00-dav.conf
cat modules/00-lua.conf > /etc/httpd/conf.modules.d/00-lua.conf
cat modules/00-mpm.conf > /etc/httpd/conf.modules.d/00-mpm.conf
cat modules/00-proxy.conf > /etc/httpd/conf.modules.d/00-proxy.conf
cat modules/01-cgi.conf > /etc/httpd/conf.modules.d/01-cgi.conf
# BASIC PERFORMANCE SETTINGS
mkdir /etc/httpd/conf.performance.d/
cat performance/compression.conf > /etc/httpd/conf.performance.d/compression.conf
cat performance/content_transformation.conf > /etc/httpd/conf.performance.d/content_transformation.conf
cat performance/etags.conf > /etc/httpd/conf.performance.d/etags.conf
cat performance/expires_headers.conf > /etc/httpd/conf.performance.d/expires_headers.conf
cat performance/file_concatenation.conf > /etc/httpd/conf.performance.d/file_concatenation.conf
cat performance/filename-based_cache_busting.conf > /etc/httpd/conf.performance.d/filename-based_cache_busting.conf
# BASIC SECURITY SETTINGS
mkdir /etc/httpd/conf.security.d/
cat security/apache_default.conf > /etc/httpd/conf.security.d/apache_default.conf
# our domain config
mkdir /etc/httpd/conf.sites.d
echo IncludeOptional conf.sites.d/*.conf >> /etc/httpd/conf/httpd.conf
cat domains/8080-domain.conf > /etc/httpd/conf.sites.d/test.conf
# our performance config
echo IncludeOptional conf.performance.d/*.conf >> /etc/httpd/conf/httpd.conf
# our security config
echo IncludeOptional conf.security.d/*.conf >> /etc/httpd/conf/httpd.conf
# fix date timezone errors
sed -i 's#;date.timezone =#date.timezone = "America/New_York"#g' /etc/php.ini
# FIREWALL
systemctl start firewalld.service
systemctl enable firewalld.service
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --add-port=22/tcp
systemctl restart firewalld.service
# Make sue services stay on after reboot
systemctl enable httpd.service
#systemctl enable mysqld.service
systemctl enable php-fpm.service
systemctl enable varnish.service
# Start all the services we use.
systemctl start php-fpm.service
#systemctl start mysqld.service
systemctl start httpd.service
systemctl start varnish.service
# Install Drush globally.
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
ln -s /usr/local/bin/composer /usr/bin/composer
echo "<?php phpinfo();?>" > /var/www/html/index.php