-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLARAVEL-CMD.txt
286 lines (167 loc) · 6.65 KB
/
LARAVEL-CMD.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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
LARAVEL PROJECT: DEPLOYING REAL LIFE APPLICATION LARAVEL
sudo apt update
sudo apt upgrade
INSTALL APACHE2
sudo apt install apache2 -y
sudo systemctl status apache2
sudo systemctl enable apache2
INSTALL GIT
sudo apt install git -y
git --version
INSTALL PHP
sudo apt -y install lsb-release apt-transport-https ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
UPDATE THE PACKAGES
sudo apt update
INSTALL PHP 8.1
sudo apt install php libapache2-mod-php php8.1-mysql php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-dev php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl -y
CHECK VERSION
php -v
INSTALL MYSQL PACKAGES
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo apt install ./mysql-apt-config_0.8.22-1_all.deb
PROMPT: Which MySQL product do you wish to configure? CLICK ENTER
PROMPT: Which server version do you wish to receive? | (selected: mysql-8.0) CLICK ENTER
PROMPT AGAIN: scroll to OK THEN ENTER
PROMPT: Which MySQL product do you wish to configure? CLICK ENTER
PROMPT: Which server version do you wish to receive? | (selected: mysql-8.0) CLICK ENTER
PROMPT AGAIN: scroll to OK THEN ENTER
UPDATE THE PACKAGES
sudo apt update
INSTALL MYSQL
sudo apt install mysql-server
PROMPT: Please provide a strong password that will be set for the root account of your MySQL database. Leave it blank to enable password less login using UNIX socket based authentication.
Enter root password: 1234
PROMPT: Now that you have selected a password for the root account, please confirm by typing it again. Do not
share the password with anyone.
Re-enter root password: 1234
PROMPT: Use Strong Password Encryption (RECOMMENDED) CLICK ENTER
PROMPT: Use Strong Password Encryption (RECOMMENDED) CLICK ENTER
CHECK MYSQL STATUS
sudo service mysql status
CREATE DATABASE
mysql -u root -p
ENTER PASSWORD: 1234
SHOW DATABASES;
CREATE DATABASE bukolaApp;
SHOW DATABASES;
exit
INSTALL COMPOSER
curl -sS https://getcomposer.org/installer | php
MAKE THE COMPOSER UNIVERAL
sudo mv composer.phar /usr/local/bin/composer
GIVE IT EXECUTABLE RIGHTS
sudo chmod +x /usr/local/bin/composer
CLONE GIT REPOSITORY
cd /var/www/html
sudo git clone https://github.com/f1amy/laravel-realworld-example-app.git ~ My-app
cd /var/www/html/laravel-realworld-example-app
RUN COMPOSER INSTALL
sudo composer install
NOTE: TYPE "YES" TO THE PROMPT
CHECK LARAVEL VERSION
php artisan
VERSION RESPONSE: Laravel Framework 9.17.0
EDIT THE APACHE VIRTUAL HOST FILE: APACHE CONFIG
cd /etc/apache2/sites-available
FIRST CREATE A NEW FILE NAMED LARAVEL.CONF USING THE BELOW COMMAND:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/laravel.conf
EDIT FILE
sudo nano /etc/apache2/sites-available/laravel.conf
<VirtualHost *:80>
ServerAdmin webmaster@44.212.4.90
ServerName 44.212.4.90
DocumentRoot /var/www/html/laravel-realworld-example-app/public
<Directory /var/www/html/laravel-realworld-example-app/public>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
To check if syntax is correct: sudo apachectl configtest
sudo a2ensite laravel.conf
sudo systemctl restart apache2
EDIT THE .ENV FILE
cd /var/www/html/laravel-realworld-example-app/
sudo cp .env.example .env
edit: sudo nano .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=My-app
DB_USERNAME=root
DB_PASSWORD=1234
PHP ARTISAN COMMANDS
sudo php artisan key:generate
sudo php artisan migrate
php artisan serve
LARAVEL PERMISSIONS AND DEBUG
sudo chmod -R 775 /var/www/html/laravel-realworld-example-app
sudo chmod -R 777 /var/www/html/laravel-realworld-example-app/storage
sudo nano /var/www/html/laravel-realworld-example-app/routes/web.php
uncomment last line */ */
sudo nano /etc/apache2/ports.conf
Listen 80
Add: Listen 8000
sudo service apache2 restart
sudo nano /etc/hosts
[...]
127.0.0.1 localhost
your-domain your-sever-name.com
For example:
12.345.678.90 altschool.demo
flush dns
resolvectl statistics | grep -i cache
Cache
Current Cache Size: 572
Cache Hits: 10767
Cache Misses: 11147
resolvectl flush-caches
resolvectl statistics | grep -i cache
>>>>>>>>>>>>>>>>>> (OPTIONAL) SECURE MYSQL >>>>>>>>>>>>>>>>>
sudo mysql_secure_installation
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
NOTE RESPONSE:
Securing the MySQL server deployment.
Enter password for user root:1234
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: ENTER KEY
NOTE NEXT RESPONSE:
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : ENTER KEY
NEXT NOTE RESPONSE:
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : ENTER KEY
NEXT NOTE RESPONSE
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ENTER KEY
NEXT NOTE RESPONSE
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : ENTER KEY
NEXT NOTE RESPONSE
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
NEXT NOTE RESPONSE
Success.
All done!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>