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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
#!/bin/sh #安裝yum的axel外掛,使yum支援多執行緒下載: #rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.x86_64.rpm #cp axelget.conf /etc/yum/pluginconf.d/ #cp axelget.py /usr/lib/yum-plugins/ #下載163 yum源: #wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -O CentOS-Base.repo #cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak #mv -f CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo #安裝epel yum源: #rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm #sed -i `s/^mirrorlist=https/mirrorlist=http/` /etc/yum.repos.d/epel.repo #nginx的yum源(推薦編譯安裝,可以獲得更好的效能): #cat > /etc/yum.repos.d/nginx.repo << `EOF` #[nginx] #name=nginx repo #baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ #enabled=1 #gpgcheck=0 #EOF yum install nginx -y
#安裝Mysql的yum源(推薦編譯安裝,獲得更好的效能): rpm -Uvh http: //dev .mysql.com /get/mysql-community-release-el6-5 .noarch.rpm
yum install mysql-devel mysql-server
#安裝php5.6 yum源(注意,這個需要先安裝好原來的php各種外掛,安裝升級的php會解除安裝舊的php, #如果發現有些外掛沒有安裝,必須得先解除安裝掉高版本的php-common然後再安裝php外掛,最後再安裝php-common) #如果mysql不在本地,還需要安裝mysqlnd(安裝mysqlnd時需要先解除安裝php-mysql) #wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm #rpm -ivh remi-release-6.rpm #yum install php-mysqlnd #php -m #檢視安裝的外掛 #安裝php 5.3 yum install php php-mysql php-fpm php-bcmath php-mbstring php-gd* libxml libxml-devel php-xml php-soap php-bcmath php-xml php-opcache php-gd php-mcrypt php-pdo php-mysql php-mbstring php-xmlrpc
#升級剛才安裝的php到5.6 rpm -Uvh https: //mirror .webtatic.com /yum/el6/latest .rpm
yum install yum-plugin-replace -y
yum replace php-common --replace-with=php56w-common -y #修改php配置: PHP_INI= "/etc/php.ini"
FPM_CONF= "/etc/php-fpm.d/www.conf"
sed -i `/^;default_charset/cdefault_charset = "utf-8"` $PHP_INI
sed -i `/^expose_php/cexpose_php = Off` $PHP_INI
sed -i `/^max_execution_time/cmax_execution_time = 600` $PHP_INI
sed -i `/^max_input_time/cmax_input_time = 600` $PHP_INI
sed -i `/^memory_limit/cmemory_limit = 256M` $PHP_INI
sed -i `/^post_max_size/cpost_max_size = 32M` $PHP_INI
sed -i `/^upload_max_filesize/cupload_max_filesize = 300M` $PHP_INI
sed -i `/^max_file_uploads/cmax_file_uploads = 30` $PHP_INI
sed -i `/^;date.timezone/cdate.timezone = "Asia/Shanghai"` $PHP_INI
sed -i `/^disable_functions/cdisable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source syslog,readlink,symlink,popepassthru,stream_socket_server` $PHP_INI
sed -i `s/apache/nginx/g` $FPM_CONF
sed -i `/^pm = dynamic/cpm = static` $FPM_CONF
sed -i `/^pm.max_children/cpm.max_children = 10` $FPM_CONF
sed -i `/^;pm.status_path/cpm.status_path = /php-status` $FPM_CONF
sed -i `/^;request_terminate_timeout/crequest_terminate_timeout=600` $FPM_CONF
sed -i `/^;request_slowlog_timeout/crequest_slowlog_timeout=3` $FPM_CONF
################################### ######編輯php.ini,修改如下一行#### always_populate_raw_post_data = -1 ################################### ######zabbix安裝頁面無法next####### setfacl -R -m u:nginx:rwx /var/lib/php
#啟動php /etc/init .d /php-fpm start
#修改/etc/nginx/nginx.conf mv /etc/nginx/nginx .conf /etc/nginx/nginx .conf.bak
echo "
user nginx; worker_processes 4; error_log /var/logs/nginx/error .log crit;
worker_rlimit_nofile 51200; events { use epoll;
worker_connections 51200;
} http { include mime.types;
default_type application /octet-stream ;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text /plain application /x-javascript text /css application /xml ;
gzip_vary on;
server_tokens off;
log_format access `$remote_addr - $remote_user [$time_local] "$request" `
`$status $body_bytes_sent "$http_referer" `
`"$http_user_agent" $http_x_forwarded_for` ;
access_log /usr/local/nginx/logs/access .log access;
reset_timedout_connection on;
include conf.d/*.conf;
} " >> /etc/nginx/nginx .conf
#建立/etc/nginx/conf.d/zabbix.conf echo "
server { listen 80;
server_name localhost.com;
location / {
root /www/zabbix ;
index index.php;
}
location ~ .php$ {
root /www/zabbix ;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
} " > /etc/nginx/conf .d /zabbix .conf
###################################################################### /etc/init .d /nginx start
#安裝zabbix 3.2 #注意:這裡centos6 yum安裝3.2會有問題,這個需要編譯安裝。 yum install libcurl libcurl-devel -y
tar zxf zabbix-3.2.5. tar .gz
cd zabbix-3.2.5
. /configure --prefix= /usr/local/zabbix --sysconfdir= /etc/zabbix --with-mysql= /usr/bin/mysql_config --with-net-snmp -- enable -agent -- enable -server --with-libcurl -- enable -proxy
make install
#從zabbix-3.2.5安裝包中複製啟動檔案: cp misc /init .d /fedora/core/zabbix_server /etc/init .d/
#修改指令碼中的基本路徑,預設路徑是/usr/local/,這裡修改為/usr/local/zabbix/etc vi /etc/init .d /zabbix_server
BASEDIR= /usr/local/zabbix
#修改配置檔案:zabbix-server.conf DBPass=zabbix #部署zabbix前端程式碼: mkdir -p /www/zabbix/
cp -r zabbix-3.2.5 /frontends/php/ * /www/zabbix/
chown -R nginx.nginx www /zabbix
chmod 755 /www/zabbix
#啟動mysql: /etc/init .d /mysqld start
#設定mysql root密碼: mysqladmin -uroot password `mysql`
#建立zabbix資料庫和使用者: mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by `zabbix` ;
#初始化zabbix資料庫: cd zabbix-3.2.5 /database/mysql/
mysql -uzabbix -pzabbix zabbix < schema.sql mysql -uzabbix -pzabbix zabbix < images.sql mysql -uzabbix -pzabbix zabbix < data.sql #啟動zabbix server和agent: /etc/init .d /zabbix-server start
/etc/init .d /zabbix-agent start
#安裝完畢,最後訪問Zabbix: http: //127 .0.0.1/
#設定開機啟動: #啟動php-fpm: /etc/init .d /php-fpm start
新增開機自啟動: chkconfig --add php-fpm chkconfig mysqld on chkconfig php-fpm on chkconfig nginx on chkconfig zabbix-server on chkconfig zabbix-agent on |
zabbix一鍵安裝lnmp環境
本文轉自 王家東哥 51CTO部落格,原文連結:http://blog.51cto.com/xiaodongge/1901005
相關文章
- oneinstack 另一個 lnmp環境一鍵安裝工具LNMP
- LNMP 環境安裝LNMP
- 安裝LNMP環境LNMP
- 一鍵化安裝 docker,一鍵化部署 lnmp+Redis 環境,快速部署 Laravel 環境DockerLNMPRedisLaravel
- macOS 安裝 LNMP 環境MacLNMP
- brew lnmp 環境安裝LNMP
- zabbix環境安裝搭建
- zabbix安裝中文環境
- PHP 一鍵 Docker LNMP 環境PHPDockerLNMP
- lnmp環境安裝詳細LNMP
- centos6.2lnmp環境下安裝zabbix(中文環境)並且監控客戶端CentOSLNMP客戶端
- zabbix一鍵安裝
- 利用 Docker 一鍵搭建 LNMP 環境DockerLNMP
- Magento2 LNMP 環境安裝LNMP
- ubuntu 16.04安裝LNMP環境UbuntuLNMP
- Docker 下安裝配置 lnmp 環境DockerLNMP
- Ubuntu20 LNMP 環境安裝UbuntuLNMP
- LNMP一鍵安裝包LNMP
- mac brew 安裝 lnmp環境 代替MampMacLNMP
- lnmp環境安裝-原始碼編譯LNMP原始碼編譯
- centos6.2LNMP環境安裝(yum)CentOSLNMP
- Laravel 之道特別篇一: yum 安裝 LNMP 環境LaravelLNMP
- 使用Docker 一鍵部署 LNMP+Redis 環境DockerLNMPRedis
- centos7使用yum安裝lnmp環境CentOSLNMP
- Linux 下使用 Docker 安裝lnmp環境LinuxDockerLNMP
- 【Linux】LNMP 環境搭建(上):安裝篇LinuxLNMP
- [Linux] LNMP 環境搭建(上):安裝篇LinuxLNMP
- lnmp一鍵安裝包下載地址LNMP
- 從零搭建LNMP環境(一) - 編譯原始碼安裝PHPLNMP編譯原始碼PHP
- PHP環境LAMP/LNMP安裝與配置筆記PHPLAMPLNMP筆記
- 如何利用LNMP環境安裝SMF論壇程式LNMP
- Mac下安裝LNMP(Nginx+PHP5.6)環境MacLNMPNginxPHP
- LNMP一鍵自動安裝指令碼LNMP指令碼
- 在 Ubuntu18.04 下安裝 LNMP 環境UbuntuLNMP
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- lnmp 一鍵安裝包部署ThinkPHP5LNMPPHP
- LNMP一鍵自動安裝指令碼薦LNMP指令碼
- CentOS Stream 8 安裝 Zabbix6.0 -- LNMP環境(nginx-1.20,mariadb-10.6,php-7.4)CentOSLNMPNginxPHP