· 6 years ago · Jan 07, 2020, 02:42 AM
1Ubuntu 18.04
2
31. Install virtualbox:
4sudo apt-get install virtualbox
5
6
72. Install vagrant:
8curl -O https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb
9sudo apt install ./vagrant_2.2.6_x86_64.deb
10
11
123. Download and create a box with version 9.1:
13vagrant box add laravel/homestead --box-version 9.1
14
15
164. Create the folders code and pollux:
17mkdir ~/code/
18mkdir ~/code/pollux
19cd ~/code/pollux/
20
21
225. Download the repositories from bitbucket.
23git clone (api repository URL)
24git clone (frontend repository URL)
25
26
276. Go to develop branch in both repositories:
28cd pollux.energy.front
29git checkout develop
30cd ..
31cd pollux.energy.api
32git checkout develop
33
34
357. Now, edit the Homestead.yaml file in pollux.energy.api:
36in the 'folders' section, change the paths so they match with these:
37- map: ~/code/pollux/
38- to: /home/vagrant/code
39
40
418. Change the name of the file .env.example to .env:
42mv .env.example .env
43
44
459. Now, check if you have the private/public key files:
46cd ~/.ssh
47ls
48
49If you have the files: id_rsa and id_rsa.pub, ignore step 10 and go to step 11:
50
5110. Create the public/private key files:
52touch id_rsa
53touch id_rsa.pub
54
55
5611. Before creating the VM, let's add the hosts to Ubuntu:
57cd ~/../../etc/
58sudo nano hosts
59
60
6112. Add these two lines to the BOTTOM of the file. This ip must match the IP in Homestead.yaml:
62192.168.11.11 pollux.test
63192.168.11.11 api.pollux.test
64
65Ctrl + O, Enter, Ctrl + X to exit.
66
67
6813. After the files are created, go back to the pollux.energy.api folder:
69cd ~/code/pollux/pollux.energy.api
70
71
7214. Now we can init the VM machine:
73vagrant up
74
75If you get a warning about composer, ignore it.
76
77
7815. Log in to the VM using ssh:
79vagrant ssh
80
81
82From this point, the commands are executed in the VM:
83If you type ls, you should see a folder with the name 'code'.
84
8516. Now, change the php version to 7.2:
86sudo update-alternatives --config php
87
88Select the option that describes PHP 7.2 (for me, it was option 4)
89
90
9117. Go to the api folder:
92cd code/pollux.energy.api
93
94
9518. Migrate and seed the database:
96php artisan migrate
97php artisan db:seed
98
99
10019. We have to change the content of a nginx file:
101cd ~/../../etc/nginx/sites-available
102sudo nano pollux.test
103
104
105
10620. Add this at the TOP of the file:
107upstream upstream-nodejs {
108 server 127.0.0.1:6002;
109}
110
111Ctrl + O, Enter, Ctrl + X to exit.
112
113
11421. Restart nginx
115sudo systemctl restart nginx
116
117
11822. Goto home:
119cd ~
120
121
12223. Install nvm:
123curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
124
125
12624. Install nodejs v8.17.0
127nvm install 8.17.0
128
129
13025. Install bower:
131npm install bower -g
132
133
13426. Install gulp:
135npm install gulp-cli -g
136
137
13827. Go to the frontend folder:
139cd code/pollux.energy.front
140
141
14228. Install the dependencies:
143npm install
144bower install
145
146
14729. Test the frontend:
148gulp serve
149
150If you see "Watching files...", you installed it succesfully
151
152
15330. In your browser, go to api.pollux.test, you should be able to see the api documentation
154If you go to pollux.test, you can see the login screen:
155
156email: admin@pollux.energy
157password: secret
158
159
160If you login and see the dashboard, you are done.