HowTo Setup the Environment on Ubuntu 1804 » History » Version 1
Peter Qian, 01/04/2021 09:16 AM
1 | 1 | Peter Qian | h1. HowTo Setup the Environment on Ubuntu 18.04 |
---|---|---|---|
2 | |||
3 | {{>toc}} |
||
4 | |||
5 | h2. Step 0: Download the ISO |
||
6 | |||
7 | Grab the latest and greatest 18.04 "here":https://www.ubuntu.com/download/desktop |
||
8 | Just a heads up it is a 1.8Gb download. |
||
9 | |||
10 | h2. Step 1: Install |
||
11 | |||
12 | Boot the ISO in a new VM (recommended) or from a flash drive via the BIOS if you want to replace your OS / dual boot. (not recommended) |
||
13 | |||
14 | Complete the Ubuntu installation steps and reboot when it asks to. |
||
15 | Welcome to 18.04 |
||
16 | |||
17 | h2. Step 2: Install MySQL |
||
18 | |||
19 | (NOTE: install MySQL-Server first or you’re going to have a bad time) |
||
20 | Open the terminal and run the command: |
||
21 | |||
22 | <pre>sudo apt install mysql-server</pre> |
||
23 | |||
24 | h2. Step 3: Install the rest |
||
25 | |||
26 | Now that MySQL is installed, we can install all the other bells and whistles: |
||
27 | |||
28 | <pre>sudo apt install apache2 curl vim php ssh phpmyadmin php-curl php-zip php-bcmath net-tools git</pre> |
||
29 | |||
30 | h2. Step 4: Creating a MySQL super user |
||
31 | |||
32 | So apparently 18.04 doesn't allow authentication via password for the root user. |
||
33 | So we get around this by creating our own super user. (NOTE: Do not do this on a production server.) |
||
34 | |||
35 | <pre>sudo mysql</pre> |
||
36 | |||
37 | (NOTE: change mypassword in the following segment of code to be whatever password you want the super user to have.) |
||
38 | |||
39 | <pre>CREATE USER 'admin'@'localhost' IDENTIFIED BY 'mypassword'; |
||
40 | GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost'; |
||
41 | GRANT GRANT OPTION ON *.* TO 'admin'@'localhost'; |
||
42 | FLUSH PRIVILEGES;</pre> |
||
43 | |||
44 | h2. Step 5: Create the Apache virtual host config file |
||
45 | |||
46 | <pre>sudo vim /etc/apache2/sites-available/local.321project.com.au.conf</pre> |
||
47 | |||
48 | <pre><VirtualHost *:80> |
||
49 | ServerAdmin username@email.com |
||
50 | ServerName local.onko.com.au |
||
51 | |||
52 | ServerSignature Off |
||
53 | |||
54 | # Turn off mod_security filtering. |
||
55 | <IfModule mod_security2.c> |
||
56 | SecFilterEngine Off |
||
57 | </IfModule> |
||
58 | |||
59 | DocumentRoot /home/myname/workspace/321project |
||
60 | <Directory /> |
||
61 | Options FollowSymLinks MultiViews |
||
62 | DirectoryIndex index.php |
||
63 | AllowOverride All |
||
64 | Header always set Access-Control-Allow-Origin "*" |
||
65 | Header set Access-Control-Allow-Credentials "true" |
||
66 | Header always set Access-Control-Allow-Methods "GET, PUT, POST, DELETE, OPTIONS" |
||
67 | Header always set Access-Control-Allow-Headers "DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Authorization,X-CSRF-Token" |
||
68 | Require all granted |
||
69 | # Modify the RewriteBase if you are using Drupal in a subdirectory and the RewriteBase / |
||
70 | </Directory> |
||
71 | |||
72 | ErrorLog /var/log/apache2/error.log |
||
73 | |||
74 | # Possible values include: debug, info, notice, warn, error, crit, |
||
75 | # alert, emerg. |
||
76 | LogLevel warn |
||
77 | |||
78 | CustomLog /var/log/apache2/access.log combined |
||
79 | </VirtualHost></pre> |
||
80 | |||
81 | h2. Step 6: Configuring all the things |
||
82 | |||
83 | Apache config stuff |
||
84 | <pre>sudo a2enmod headers rewrite |
||
85 | sudo a2ensite local.onko.com.au</pre> |
||
86 | |||
87 | Edit the hosts file |
||
88 | <pre>cd /etc |
||
89 | sudo vim hosts</pre> |
||
90 | |||
91 | and add the following line near the top (‘i’ to insert in vim): |
||
92 | |||
93 | <pre> |
||
94 | 127.0.0.1 local.onko.com.au |
||
95 | </pre> |
||
96 | |||
97 | <esc> :wq //escape to exit insert mode, :wq to write and quit |
||
98 | |||
99 | |||
100 | restart Apache so the changes take effect |
||
101 | |||
102 | <pre>systemctl restart apache2</pre> |
||
103 | |||
104 | h2. Step 7: Install Composer |
||
105 | |||
106 | <pre>php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" |
||
107 | php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffb c1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" |
||
108 | php composer-setup.php |
||
109 | php -r "unlink('composer-setup.php');" |
||
110 | |||
111 | sudo mv composer.phar /usr/local/bin/composer |
||
112 | </pre> |
||
113 | |||
114 | h2. Step 8: Installing the Service Club Base |
||
115 | |||
116 | The Drupal Base install can be found at: https://github.com/didymo/service_club_base |
||
117 | |||
118 | Use the following commands to git clone it to your workspace folder. |
||
119 | |||
120 | <pre> |
||
121 | cd |
||
122 | mkdir workspace |
||
123 | cd workspace |
||
124 | git clone https://github.com/didymo/service_club_base.git |
||
125 | cd service_club_base |
||
126 | composer install |
||
127 | </pre> |
||
128 | |||
129 | h2. Step 9: Drupal configuration |
||
130 | |||
131 | Open your favourite internet browser and go to: http://local.onko.com.au |
||
132 | |||
133 | Follow the drupal site install instructions, and you will have a working local site! |