-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvagrant.txt
158 lines (114 loc) · 3.81 KB
/
vagrant.txt
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
Vagrant + VirtualBox + CentOS8 + Nginx + PHP7.4 + MySQL8.0
------------------------------
https://qiita.com/j-yamada/items/3efdc08b64064eaad9e1
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-8
Vagrantfile
------------------------------
Vagrant.configure("2") do |config|
# CentOS8
config.vm.box = "generic/centos8"
config.vm.network "private_network", ip: "192.168.50.11"
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 1
end
config.vm.synced_folder ".", '/var/www', :mount_options => ['dmode=777', 'fmode=777']
end
#stat() "/var/www/html/index.html" failed (13: Permission denied)
-----------------------------
sudo vi /etc/selinux/config
SELINUX=disabled
vagrant command
-----------------------------
vagrant up
vagrant ssh
vagrant halt
#set timezone
-----------------------------
sudo timedatectl set-timezone America/Los_Angeles
#set firewall
-----------------------------
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --add-port=9000/tcp --permanent
sudo firewall-cmd --reload
sudo systemctl stop firewalld
#install nginx
-----------------------------
sudo dnf install -y nginx
#Since the standard of CentOS8 is 7.2, the repository is dropped first.
-----------------------------
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
#Turn off the default php module. If you do not turn it off, you will have to specify the repository and install it every time.
-----------------------------
sudo dnf module disable -y php
sudo dnf module install -y php:remi-7.4
sudo dnf install -y php-mysqlnd php-pecl-xdebug php-intl php-zip
#setup xdebug
-----------------------------
sudo vi /etc/php.d/15-xdebug.ini
xdebug.default_enable = 1
xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.remote_connect_back = On
xdebug.remote_port = 9000
#setup php-fpm
---------------------------------
sudo vi /etc/php-fpm.d/www.conf
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
#setup nginx
---------------------------------
sudo vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name dev.eert.info;
root /var/www/html;
#root /usr/share/nginx/html;
index index.php index.html index.htm;
charset utf-8;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php-fpm/www.sock;
try_files $uri =404;
}
}
~
#Process restart. It is set to work when the OS starts.
-----------------------------------
sudo systemctl restart nginx
sudo systemctl restart php-fpm
sudo systemctl enable nginx
sudo systemctl enable php-fpm
sudo dnf install -y @mysql
NOT WORK sudo rm -rf /var/lib/mysql
NOT WORK sudo mysqld --initialize-insecure --datadir=/var/lib/mysql --user=mysql
sudo systemctl restart mysqld
sudo systemctl enable mysqld
#add dns record in host (out of vagrant)
------------------------------------
sudo vi /etc/hosts
192.168.50.11 dev.eert.info
#install nodejs and git
------------------------------------
curl -sL https://rpm.nodesource.com/setup_15.x | sudo bash -
sudo yum install -y nodejs
sudo yum install git
#remove all npm modules globally
------------------------------------
npm ls -gp --depth=0 |
awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' |
xargs npm -g rm