laravel and vuejs installation in aws from scratch



services

compute

ec2

volumes

create a volume

give the examle gb 100

create volume



come down 
create voluem
==

after created volume 

its redirect to voulme list page

u can click on created volme

u can see total volume details



then go to instances 

left side bar

click on launch instance at instanc page

after its redirect to instance page

give the name 
select os  ( i selected ubuntu)
slect the machine image
architechture (default  selected(


select the key or create new key pair


pem is for ssh
ppk is for putty

aftrer click on create key pair 
it wil download to your local
remember the location where it is stored

after thet click on instances in side bar

then click on required instance row clock

click on connect 
it wirll redirect to instance page

you have pem file
go to where downloaded
and then enter
chmod 400 "pem file  name"

then 
ssh -i "pem file" ubuntu@ipaddressor domain name
given in above image


whjenver u enter that in terminal it shows connected succesfully then 
it will show specs


go back to list on instances page at aws
click on required isntances
it show the details in below window


click on security tab

click on that blue link security groups under
click on edit inbound rules
then
edit inbound rules




in terminal
sudo password root
change password 
new password 
retype



then chang e
sudo nano /etc/ssh/sshd_config
ctr+w

search for root
modify like this PermitRootLogin yes

then 



click on add rule
select alltcp
anywhere ipv4
select 0 ---



click on save rule

select the public dns 
it copy and enter into browser


similarly
PasswordAuthentication yes


ctrl+x
yes
name enter
then its saved

then reload this file

sudo service sshd reload

then 

sudo apt update

sudo apt upgrade

sudo apt install zip unzip

sudo apt install apache2

sudo service apache2 restart

it have to show like this default page when u visit browser ( when u copy the public ipv4dns)




then start to install laravel application using docker 

clone the git repository this 
git clone https://gitlab.com/vamsigdv/docker-laravel.git

it is a public repository 
then there is no need of user name and apassword

then 
ls
then move to docker-laravel
git checkout laravel

swithc to laravel branch 

git pull orgin laravel

docker-compose u p -d


not installaed docker 

so install docker step by step 
  1. sudo apt update


sudo apt install apt-transport-https ca-certificates curl software-properties-common

Next, install a few prerequisite packages which let apt use packages over HTTPS:

  1. sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

  1. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

  1. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Finally, install Docker:

  1. sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

  1. sudo systemctl status docker


if u know the terminal password
sudo usermod -aG docker ${USER}

su - ${USER}

docker -v

docker-compose -v
sudo apt install docker-compose

to know the password 
cat /etc/password

if sudo is must

sudo -i 

or 
sudo docker-compose up -d


docker ps -a
to knwo the containers status
docker images -a

to know the images status


url:8000


in docker file u can see the 
docker-compose.yml in 
\
phpmyadmin_testing:
    container_name: phpmyadmin_testing
    image: phpmyadmin/phpmyadmin
    restart: always
    environment:
        - PMA_HOST=mysql_testing
        - PMA_PORT=3306
    ports:
        - 8000:80

this is the database name and passwor d

 "MYSQL_USER=testing"
        - "MYSQL_PASSWORD=ueDMcQVb8JVCyjws"

check nginx server
 nginx:
    container_name: nginx
    image: nginx:1.17
    restart: always
    ports:
        - "9999:9999"

url:9999

check the databse connecting to root password

sudo docekr exec -it mysql_testing mysql -uroot -pueDMcQVb8JVCyjw
 docker exec -it mysql_testing mysql -uroot -pueDMcQVb8JVCyjw
  - "MYSQL_ROOT_PASSWORD=ueDMcQVb8JVCyjw"
        - "MYSQL_DATABASE=testing"

its logined to database from terminal

show databases;
exit


./dock php php artisan migrate 

if it is migratee it is ok 
otherwise 
error 

change the folder name to
oocker-laravel

nginx/default.conf folder 
i given my-laravel-app
so change the folder name to docker-laravel
folder nam e
is 
www/ in this location all fodlers is to be
move this folder 
mv docker-laravel www
docker-laravel move to www

then connect docker to mynetwork
docker network create --driver bridge mynetwork

docker network inspect mynetwork

docker network connect mynetwork php
docker network connect mynetwork mysql_testing
docker network inspect mynetwork

ls dockerFIle
nano DockerFile

if u got any eror while crfeating containers or iamges

just remove contaienrs and images , then re build

docker kill $(docker ps -q)
docker rm $(docker ps -a -q)

docker rmi -f $(docker images -q)
remove the container

sudo docker rm  composer php phpmyadmin
stop the contaienrs and then remove the containers

mv www larvel 
move the laravel to www

install composer 
sudo apt install composer 
composer update
composer install
composer dump-autoload
composer -v
php -v 
update php to latest version
sudo apt install php -curl

sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.2
sudo apt install php8.2-curl
sudo update-alternatives --set php /user/bin/php8.2
sudo update-alternatives --set php /usr/bin/php8.2

sudo service apache2 restart
sudo apt install php-xml 
sudo apt install php-dom
sudo systemctl restart php-fpm
sudo 
php -i | grep intl
normaliser not found
sudo apt install php-intl

sudo apt install php-intl
sudo systemctl restart apache2
sudo systemctl restart nginx
sudo systemctl restart mysql
sudo systemctl restart php-fpm
sudo systemctl restart docker

  1. SysVinit Services (older CentOS, Debian, Ubuntu):

    • Restart Apache:
      bash
      sudo service apache2 restart
    • Restart Nginx:
      bash
      sudo service nginx restart
    • Restart MySQL:
      bash
      sudo service mysql restart
    • Restart PostgreSQL:
      bash
      sudo service postgresql restart
    • Restart PHP-FPM:
      bash
      sudo service php-fpm restart
    • Restart Docker:
      bash
      sudo service docker restart
=
sudo apt install php8.2-curl
sudo apt install php8.2-mbstring
sudo apt install php8.2-intl

mv .env-example .env

php artisan key:generate
php network get address get adddre info failed 
temporar yfailure in name in resiluton

below thing

http://localhost:8000/
http://localhost:9999/

docker-compose up -d

docker kill $(docker ps -q)
docker rm $(docker ps -a -q)

docker rmi -f $(docker images -q)
docker-compose stop
docker-compose down
docker ps -a
docker images -a


docker exec -it mysql_testing mysql -uroot -pueDMcQVb8JVCyjw

php and mysql_testing not connected to same network


docker network create --driver bridge mynetwork


docker network inspect mynetwork

docker network connect mynetwork php
docker network connect mynetwork mysql_testing
docker network inspect mynetwork

./dock php php artisan migrate

===

sudo apt install mysql-server
sudo nano /etc/phpmyadmin/config-db.php
sudo mysql

sudo apt install php8.2 libapache2-mod-php8.2 php8.2-mbstring php8.2-xmlrpc php8.2-soap php8.2-gd php8.2-sqlite3 php8.2-cli php8.2-zip php8.2-bcmath php8.2-tokenizer php8.2-json php8.2-pear php8.2-mysql php8.2-gettext php8.2-curl php8.2-memcached php8.2-xdebug php8.2-intl php8.2-fpm php8.2-pgsql php8.2-imap


sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-sqlite3 php-cli php-zip php-bcmath php-tokenizer php-json php-pear php-mysql php-gettext php-curl php-memcached php-xdebug php-intl php-fpm php-pgsql php-imap


conclusion 
sudo password root
2 sudo passwd root
3 sudo nano /etc/ssh/sshd_config
4 sudo service sshd reload
5 sudo apt update
6 sudo apt upgrade
7 sudo systemctl restart ssh
8 sudo apt install zip unzip
9 sudo apt install apache2
10 sudo service apache2 restart
11 php -v
12 sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-sqlite3 php-cli php-zip php-bcmath php-tokenizer php-json php-pear php-mysql php-gettext php-curl php-memcached php-xdebug php-intl php-fpm php-pgsql php-imap
13 sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-sqlite3 php-cli php-zip php-bcmath php-tokenizer php-json php-pear php-mysql php-curl php-memcached php-xdebug php-intl php-fpm php-pgsql php-imap
14 php -v
15 git clone https://gitlab.com/vamsigdv/docker-laravel.git
16 ls
17 sudo mkdir www
18 mv docker-laravel www
19 sudo chmod -R 777 www
20 mv docker-laravel www
21 ls
22 cd www
23 ls
24 git checkout laravel
25 cd docker-laravel/
26 git checkout laravel
27 git pull origin laravel
28 ls
29 cd ../
30 cd docker-laravel/
31 git clone https://gitlab.com/vamsigdv/docker-laravel.git
32 sudo apt install apt-transport-https ca-certificates curl software-properties-common
33 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
34 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
35 sudo apt install docker-ce
36 sudo systemctl status docker
37 docker -v
38 docker-compose -v
39 sudo apt install docker-compose
40 docker-compose -v
41 docker ps -a
42 sudo -i
43 sudo docker-compose up -d
44 ls
45 docker-compose up -d
46 sudo systemctl restart docker
47 sudo systemctl status docker
48 docker-compose up -d
49 docker -v
50 ls
51 cat docker-compose.yml
52 mv docker-laravel my-laravel-app
53 cd ../
54 mv docker-laravel my-laravel-app
55 ls
56 cd my-laravel-app/
57 docker-compose up -d
58 cd ../
59 docker -v
60 cd my-laravel-app/
61 ls
62 cat docker-compose.yml
63 docker-compose up -d
64 pip install --upgrade docker
65 docker -v
66 docker-compose -v
67 docker-compose up -d
68 cd ../
69 docker run hello-world
70 sudo docker run hello-world
71 ls
72 cd ../
73 rm -rf www
74 ls
75 git clone https://gitlab.com/vamsigdv/docker-laravel.git
76 ls
77 cd docker-laravel/
78 ls
79 git checkout larvel
80 git checkout laarvel
81 git checkout laravel
82 git pull origin laravel
83 docker-compose up -d
84 docker
85 docekr -v
86 docker -v
87 sudo docker-compose up -d
88 docker compose u p -d
89 docker compose up -d
90 sudo docker compose up -d
91 ls
92 mv docker-laravel my-laravel-app
93 cd ../
94 mv docker-laravel my-laravel-app
95 ls
96 sudo mkdir www
97 mv my-laravel-app www
98 sudo chmod -R 777 www
99 ls
100 mv my-laravel-app www
101 ls
102 cd www
103 ls
104 docker kill $(docker ps -q)
105 docker rm $(docker ps -a -q)
106 docker rmi -f $(docker images -q)
107 sudo -i
108 ls
109 cd my-laravel-app/
110 docker compose up -d
111 sudo docker compose up -d
112 composer -v
113 sudo apt install composer
114 composer update
115 composer install
116 composer dump-autoload
117 cat .nv
118 cat .env
119 sh clear-all-cache.sh
120 docker network create --driver bridge mynetwork
121 sudo -i
122 ./dock php php artisan migrate
123 sudo ./dock php php artisan migrate
124 docker exec -it php bash
125 sudo docker exec -it php bash
126 sudo -i
127 cd
128 chown -R www-data:www-data /var/www/html/my-laravel-app
129 chown -R www-data:www-data /var/www/html/my-laravel-app
130 chmod -R 755 /var/www/html/my-laravel-app
131 cd www
132 cd my-laravel-app/
133 docker exec -it php bash
134 sudo docker exec -it php bash
135 sudo -i
136 history

sudo docker exec -it php bash

cd my-laravel-app
2 ls
3 cd www/my-laravel-app
4 php artisan migrate
5 chown -R www-data:www-data /var/www/html/my-laravel-app
6 chmod -R 755 /var/www/html/my-laravel-app
7 exit
8 pwd
9 cd ../
10 pwd
11 ls
12 cd my-laravel-app/
13 php artisan migrate
14 php artisan key:generate
15 history


sudo -i
root@ip-172-31-24-214:~# history
1 dokcer-compose up -d
2 docker-compose up -d
3 exit
4 docker kill $(docker ps -q)
5 docker rm $(docker ps -a -q)
6 docker rmi -f $(docker images -q)
7 ls
8 exit
9 docker network create --driver bridge mynetwork
10 docker network inspect mynetwork
11 docker network connect mynetwork php
12 docker network connect mynetwork mysql_testing
13 docker network inspect mynetwork
14 exit
15 chown -R www-data:www-data /var/www/html/my-laravel-app
16 chmod -R 755 /var/www/html/my-laravel-app
17 exit
18 history



===

vuejs 


cd frontend/
141 docker compose u p -d
142 docker compose up -d
143 sudo -i
144 sudo docker compose up -d
145 sudo ./dock node npm run server
146 docker exec -it node bash
147 sudo docker exec -it node bash
148 npm run build
149 npm install -g @vue/cli
150 npm install -g npm@10.6.0
151 npm install -g npm@8
152 sudo npm install -g npm@8
153 npm -v
154 sudo npm install -g npm@10.6.0
155 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
156 nvm ls-remote
157 export NVM_DIR="$HOME/.nvm"
158 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
159 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
160 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
161 exit
162 cd www
163 cd frontend/
164 nvm use 8
165 nvm install 10
166 nvm use 10
167 npm -v
168 nod e-v
169 node -v
170 sudo apt update
171 sudo apt install nodejs
172 nvm list-remote
173 nvm install 20.12.2
174 nvm use 20.12.2
175 node -v
176 npm install -g @vue/cli
177 vue -v
178 vue -V
179 npm run build
180 npm install --save-dev @vue/cli-service
181 npm install
182 npm run build
183 ls
184 nano docker-compose.yml
185 cd nginx
186 ls
187 cat default.conf
188 cd ../
189 docker-compose build
190 docker-compose up -d
191 docker compose build
192 sudo docker compose build
193 sudo docker compose u p-d
194 sudo docker compose up -d
195 npm install
196 cat docker-compose.yml
197 cat Dockerfile
198 docker-compose logs node
199 docker compose logs node
200 sudo docker compose logs node
201 ppwd
202 pwd
203 nano docker-compose.yml
204 docker compose up -d
205 nano docker-compose.yml
206 git status
207 git diff
208 nano docker-compose.yml
209 docker compose up -d
210 dudo docker compose up -d
211 sudo docker compose up -d
212 git status
213 history



No comments:

Post a Comment

server laravel application

 asset_url = domain/public chmod -R 755 public/admin/ composer dump-autoload get the application from hostinger