정보통신공학과 노선변경기
퍼블릭 클라우드 5일차 Azure 마무리, GCP 본문
리소스그룹생성 > 네트워크 생성 > 데이터베이서 생성 > 객체 > vm centos > 이미지 > 워드프레스
*Azure 파일 공유
NFS와 유사
SMB: Server Message Block 를 사용한다.
VM생성후에 ssh접속하고
sudo mkdir /mnt/heonpolishare
if [ ! -d "/etc/smbcredentials" ]; then
sudo mkdir /etc/smbcredentials
fi
if [ ! -f "/etc/smbcredentials/heonpolistorage.cred" ]; then
sudo bash -c 'echo "username=heonpolistorage" >> /etc/smbcredentials/heonpolistorage.cred'
sudo bash -c 'echo "password=EEGBjFK9eejyPfAHGYBq+p36OMKxoMj68gfEuiVO6yJQziA0HZTTT5SjpeOokUjayKXZI5y7Mf0h70FINXKTJw==" >> /etc/smbcredentials/heonpolistorage.cred'
fi
sudo chmod 600 /etc/smbcredentials/heonpolistorage.cred
sudo bash -c 'echo "//heonpolistorage.file.core.windows.net/heonpolishare /mnt/heonpolishare cifs nofail,vers=3.0,credentials=/etc/smbcredentials/heonpolistorage.cred,dir_mode=0777,file_mode=0777,serverino" >> /etc/fstab'
sudo mount -t cifs //heonpolistorage.file.core.windows.net/heonpolishare /mnt/heonpolishare -o vers=3.0,credentials=/etc/smbcredentials/heonpolistorage.cred,dir_mode=0777,file_mode=0777,serverino
위에 스크립트를 복사붙여넣기하면(AZURE에서 제공하는 Scripts)
내가 만들어준 파일공유폴더 이름으로 centos에서도 생성이되고
파일공유를 통해 업로드된것이 VM에서도 공유가 가능하게된다.
*VM 생성시 사용자 지정 데이터
httpd를 vm생성시에 자동으로 만들어주기
azure.tar는 강사님이 공유하신 tar파일
#!/bin/bash
yum install -y httpd
systemctl enable --now httpd
mkdir ~/data && cd $_
wget https://heonpolistorage.blob.core.windows.net/heonpoliblob/azure.tar
tar -xvf azure.tar -C /var/www/html/
AZURE에서 centos7 가상머신을 설치하는 것도 AWS와 유사하다.
SSH 연결을 열어준다면 키쌍 하나를 받는데, 하나는 가상머신에(자물쇠의 역할) 하나는 호스트에(열쇠의 역할)
**가상머신 백업의 두가지 방법
기존가상머신 => 스냅샷 => 가상머신 생성
기존가상머신 => 이미지 => 가상머신 생성
**가상머신에서 mysql 접근
// MariaDB 설치(ami : ubuntu18) centos나 win10에 해당 없음
$ sudo apt-get -y update
$ sudo apt-get -y install mariadb-server
$ sudo mysql_secure_installation
$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
$ sudo systemctl restart mysql
RDS mysql 설정
sudo mysql -h heonpolidb.mysql.database.azure.com -u heonpoli@heonpolidb -p
CREATE USER 'wpuser'@'%' IDENTIFIED BY 'wppass';
CREATE DATABASE IF NOT EXISTS wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'%';
quit
$ sudo yum install -y httpd php php-mysql php-gd php-mbstring wget unzip
$ sudo wget https://ko.wordpress.org/wordpress-4.8.2-ko_KR.zip
$ cd /var/www/html
$ sudo unzip /root/wordpress-4.8.2-ko_KR.zip
$ sudo chown -R apache:apache wordpress
$ sudo systemctl restart httpd
$ sudo systemctl enable httpd
웹브라우저 http://본인 ip/wordpress
curl http://checkip.amazonaws.com
GCP
GCP에서는 AWS, AZURE에서 해줬던 그대로 진행했음, 콘솔의 이름에도 큰 차이가 없고 혼자서도 수행가능할 정도의 난이도
#!/bin/bash
yum install -y httpd
systemctl enable --now httpd
mkdir ~/data && cd $_
wget https://storage.googleapis.com/heonpoli/gcp.tar
tar -xvf gcp.tar -C /var/www/html/
// MariaDB 설치(ami : ubuntu18) centos나 win10에 해당 없음
$ sudo apt-get -y update
$ sudo apt-get -y install mariadb-server
$ sudo mysql_secure_installation
$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
$ sudo systemctl restart mysql
RDS mysql 설정
sudo mysql -h 34.64.191.64 -u root -p
CREATE USER 'wpuser'@'%' IDENTIFIED BY 'wppass';
CREATE DATABASE IF NOT EXISTS wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'%';
quit
워드프레스 설치
$ sudo yum install -y httpd php php-mysql php-gd php-mbstring wget unzip
$ sudo wget https://ko.wordpress.org/wordpress-4.8.2-ko_KR.zip
$ cd /var/www/html
$ sudo unzip /root/wordpress-4.8.2-ko_KR.zip
$ sudo chown -R apache:apache wordpress
$ sudo systemctl restart httpd
$ sudo systemctl enable httpd
웹브라우저 http://본인 ip/wordpress
curl http://checkip.amazonaws.com
#!/bin/bash
yum install -y httpd
systemctl enable --now httpd
mkdir ~/data && cd $_
wget https://storage.googleapis.com/heonpoli/gcp.tar
tar -xvf gcp.tar -C /var/www/html/
// MariaDB 설치(ami : ubuntu18) centos나 win10에 해당 없음
$ sudo apt-get -y update
$ sudo apt-get -y install mariadb-server
$ sudo mysql_secure_installation
$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
$ sudo systemctl restart mysql
RDS mysql 설정
sudo mysql -h 34.64.191.64 -u root -p
CREATE USER 'wpuser'@'%' IDENTIFIED BY 'wppass';
CREATE DATABASE IF NOT EXISTS wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'%';
quit
워드프레스 설치
$ sudo yum install -y httpd php php-mysql php-gd php-mbstring wget unzip
$ sudo wget https://ko.wordpress.org/wordpress-4.8.2-ko_KR.zip
$ cd /var/www/html
$ sudo unzip /root/wordpress-4.8.2-ko_KR.zip
$ sudo chown -R apache:apache wordpress
$ sudo systemctl restart httpd
$ sudo systemctl enable httpd
웹브라우저 http://본인 ip/wordpress
curl http://checkip.amazonaws.com
'Sub5_퍼블릭 클라우드' 카테고리의 다른 글
퍼블릭 클라우드 4일차 Azure 가상머신, DNS, LB, IIS (0) | 2021.07.11 |
---|---|
퍼블릭 클라우드 3일차 AWS 템플릿, VPC, RDS(Mysql), 워드프레스(wordpress) (0) | 2021.07.11 |
퍼블릭 클라우드 2일차 AWS (0) | 2021.07.11 |
퍼블릭 클라우드 1일차 핵심서비스 (0) | 2021.07.11 |