---
# System prepended metadata

title: 雲端MidTerm

---

# 雲端MidTerm
- **1063012 方語軒**

目錄
==
[Toc]


伺服器的BIOS設定與USB boot製作
===
## USB Boot製作

## 建立ubuntu開機碟

![](https://i.imgur.com/yUhBCde.png)

![](https://i.imgur.com/fCHtGr2.jpg)
## 伺服器BIOS設定

### 設定帳號密碼
![](https://i.imgur.com/dYSQQO1h.jpg)

## 設定網路
![](https://i.imgur.com/x4Q1OSBh.jpg)

**installing...**

![](https://i.imgur.com/r1Rg2xQ.jpg)
![](https://i.imgur.com/oWdie14.jpg)

### 利用PuTTY連上server
![](https://i.imgur.com/yckiJhw.png)

### 連上畫面
![](https://i.imgur.com/x0waJft.png)


## 安裝kvm套件
```
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
```
![](https://i.imgur.com/NF1BBBX.png)

##  設定網路ip
```
sudo ip addr flush
sudo ip addr add 10.2.200.206/25 dev eno1
sudo ip addr set dev eno1
sudo ip link
```
![](https://i.imgur.com/LgPcLfZ.jpg)


安裝OpenStack
===

## 安裝microstack
Install OpenStack yourself : https://ubuntu.com/openstack/install

```
$ sudo snap install microstack --devmode --beta
```
![](https://i.imgur.com/gJpnXD5.png)
```
$ sudo microstack init --auto --control
```
### 登入openstack
![](https://i.imgur.com/AKzirN0.png)
**帳號:admin
密碼:cyrpDtvZggMT44eHEUCb2JzYWwcgkNf4**

![](https://i.imgur.com/OmYQcDg.png)

### Working
![](https://i.imgur.com/j0ZluuF.png)

## 連接網路
https://connection.rnascimento.com/2021/03/08/openstack-single-node-microstack/

## 建立 Physical Network
![](https://i.imgur.com/uGVJmcQ.png)

### 建立子網路
![](https://i.imgur.com/2szIknt.png)

**IP區間 : 10.2.200.207-210**

![](https://i.imgur.com/GO8PKv9.png)


### 建立 Router
![](https://i.imgur.com/JOuaDGQ.png)

### Add Interface
![](https://i.imgur.com/KTB5Njx.png)

### Allocate FloatingIPs
![](https://i.imgur.com/r11mKJI.png)
![](https://i.imgur.com/6UTvQW4.png)

<font size=4>**Floating ip:**</font><br>
- **10.2.200.210**
- *1

### 重啟 microstack
```
 sudo snap disable microstack
 sudo snap enable microstack
```
## 掛載 Ubuntu image

https://docs.openstack.org/glance/pike/admin/manage-images.html

```
$ openstack image create --disk-format qcow2 --container-format bare \
 --public --file ubuntu-20.04.2-live-server-amd64.iso ubuntu-20.04.2
```

https://www.geek-share.com/detail/2777268145.html
https://ask.openstack.org/en/question/117479/failed-to-discover-available-identity-version-when-contacting-http192168xx5000v3-attempting-to-parse-version-from-url/
https://blog.csdn.net/m0_37313888/article/details/89358538
https://clay-atlas.com/blog/2020/03/23/linux-%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4%E5%88%97%E6%8E%9B%E8%BC%89-usb-%E8%A3%9D%E7%BD%AE/
h10 server
![](https://i.imgur.com/cEQPaHb.png)

https://ithelp.ithome.com.tw/articles/10185936
## 建立虛擬機
## 設定名稱
![](https://i.imgur.com/YzbXSvR.png)
#### 虛擬機掛載ubuntu
![](https://i.imgur.com/3J1DSgt.png)
#### 設定網路
![](https://i.imgur.com/vl7kBBG.png)
#### 綁定flouting IP
![](https://i.imgur.com/AhtKDE2.png)
![](https://i.imgur.com/UVrmWG7.png)

#### 虛擬機執行畫面
![](https://i.imgur.com/1maD2V7.png)

![](https://i.imgur.com/QupLNYj.png)

#### 遠端連線
![](https://i.imgur.com/NE6oRSq.png)

## 虛擬機運作(LAMP,phpinfo())


```
sudo dhclient ens3
```
安裝Lamp
==
https://ithelp.ithome.com.tw/articles/10216362
### 更新套件清單
```
sudo apt update
```
## 安裝Lamp Server
**安裝具有Apache+MariaDB+PHP7.2語言+資料庫管理介面phpMyAdmin套件，完成一個具有資料庫的動態網頁程式設計的開發環境**
*  安裝 Apache Server
`sudo apt-get intstall apache2`
*  安裝 phpmyadmin 套件
`sudo apt-get install phpmyadmin`
*  下載 EPEL Repository 及 Remi Repo :
`yum install epel-release`
`rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm`
*  安裝MariaDB
`sudo yum -y install nginx php70-php-fpm mariadb-server`
*  安裝httpd
`sudo yum -y install httpd`
*  避免網頁目錄被讀取
修改 /etc/apache2/apache2.conf  檔案
移除<Directory / > 和 </Directory> 中間的Indexs字眼
*  移除網頁伺服器資訊
修改/etc/apache2/conf-available/localized-error-pages.conf
設定ErrorDocume 403 內容
*  修改/etc/apache2/mods-available/php5.conf，設定
```
<IfModule mod_userdir.c>

 <Directory /home/*/public_html>

               php_admin_value engine On

 </Directory>

</IfModule>
```
*  重啟apache
`sudo service apache2 restart`
*  允許防火牆讓 HTTP、HTTPS 封包通過。
`sudo firewall-cmd --permanent --zone=public --add-service=http`
`sudo firewall-cmd --permanent --zone=public --add-service=https`
`sudo firewall-cmd --reload`
*  啟動 httpd，並讓它在開機後自動啟動。
`sudo systemctl start httpd`
`sudo systemctl enable httpd`
*  啟動 MariaDB Server，並讓它在開機後自動啟動。
`sudo systemctl restart mariadb`
`sudo systemctl enable mariadb`
*  為 Apache 加入 PHP 的支援，重新啟動 Apache 就可以了。
`sudo systemctl restart httpd`
*  建立一個 PHP 測試檔。
`sudo vi /var/www/html/info.php`
*  呼叫內建函數。
`<?php phpinfo(); ?>`
### 建立一個call phpinfo()的網頁
```
cd /var/www/html
sudo nano info.php
```
### info.php填入以下內容
```
<?php
    phpinfo();
?>
```
### 在 Openstack 編輯 Security Group 
Project > Network > Security Group > Manage Rules > Add Rules
![](https://i.imgur.com/qW5ozkH.png)
![](https://i.imgur.com/nkc2aiF.png)

## 對虛擬機 Associate Floating IP
於此步驟後在瀏覽器上打上位址即可看到phpinfo()所回應之結果
![](https://i.imgur.com/oZlzbuu.png)


結果
==

### 1063012 方語軒

http://10.2.200.210/info.php
![](https://i.imgur.com/mDhZ6ee.png)
