阿里云操作

1阿里云概述

1.1 云服务器厂商

国内: 阿里云 腾讯云 百度云 京东云 华为云 青云 ucloud
国外: AWS google Azure

1.2 架构的区别

1.3 阿里云界面


1.4计费方式

包年包月 按月付费

1.5 抢占式实例

1.6 可用区域


1.6 ECS


1.6 镜像

不用自己装系统

1.7 存储

1.8 网络和安全组




1.9 安全组

1.10 系统设置

1.11 确认订单


1.12 创建成功

1.13 控制台

1.14 意外情况

1.15 连接密码


1.16 弹性公网IP







1.17 连接测试

[d:\~]$ ssh root@120.24.174.219
[root@tomcat01 ~]# ip r
default via 172.16.0.253 dev eth0
169.254.0.0/16 dev eth0 scope link metric 1002
172.16.0.0/24 dev eth0 proto kernel scope link src 172.16.0.39

1.18 挂载数据盘

[root@tomcat01 ~]# fdisk -l|grep dev
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
/dev/vda1 * 2048 83875364 41936658+ 83 Linux
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
[root@tomcat01 ~]# mkfs.xfs /dev/vdb
meta-data=/dev/vdb isize=512 agcount=4, agsize=1310720 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
ta = bsize=4096 blocks=5242880, imaxpct=25
▽ = sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@tomcat01 ~]# mkdir /data
[root@tomcat01 ~]# blkid
/dev/vda1: UUID="1114fe9e-2309-4580-b183-d778e6d97397" TYPE="ext4"
/dev/vdb: UUID="4edca30b-93f2-440e-bd00-fbb2b067388c" TYPE="xfs"
[root@tomcat01 ~]# tail -1 /etc/fstab
UUID=4edca30b-93f2-440e-bd00-fbb2b067388c /data xfs defaults 0 0
[root@tomcat01 ~]# mount -a
[root@tomcat01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.9G 36G 6% /
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 492K 919M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb 20G 33M 20G 1% /data

1.19 阿里云安装tomcat

yum install tree vim wget bash-completion bash-completion-extras lrzsz net-tools sysstat
iotop iftop htop unzip telnet
yum install java -y
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.43/bin/apache-tomcat-
8.5.43.tar.gz
tar zxf apache-tomcat-8.5.43.tar.gz -C /opt/
ln -s /opt/apache-tomcat-8.5.43 /opt/tomcat
cd /opt/tomcat/
./bin/startup.sh
netstat -lntup|grep 8080

1.20 安全组开方8080端口


1.21 安装nginx和php

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd
php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71wopcache
php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb

2 云数据库











2.1 创建高权限用户

2.2 测试连接

[root@tomcat01 ~]# mysql -uroot -pOldzhang123456 -hrm-
wz97115cflb3rhrtx.mysql.rds.aliyuncs.com MySQL [(none)]>
MySQL [(none)]> select user,host from mysql.user;
+---------------+---------------+
| user          | host         |
+---------------+---------------+
| aurora        | %            |
| aurora_proxy  | %            |
| root          | %            |
| replicator    | 11.216.253.67 |
| aliyun_root   | 127.0.0.1    |
| mysql.session | localhost    |
| mysql.sys     | localhost    |
+---------------+---------------+

2.3 创建数据库

2.4 授权账号

2.5 查看账号

3 LNMP设置

3.1 web端配置




3.2 NAS





3.3 挂载测试

[root@tomcat01 ~]# yum install nfs-utils -y
[root@tomcat01 ~]# mount -t nfs -o vers=4,minorversion=0,noresvport 2033e486dc-bpq27.cnshenzhen.
nas.aliyuncs.com:/ /mnt

#挂载到wordpress目录
cd /code/wordpress/wp-content
mv uploads uploads_bak
mount -t nfs -o vers=4,minorversion=0,noresvport 2033e486dc-bpq27.cnshenzhen.
nas.aliyuncs.com:/ /code/wordpress/wp-content/uploads
mv uploads_bak/* uploads/
rm -rf uploads_bak/
[root@tomcat01 ~]# tail -1 /etc/fstab
2033e486dc-bpq27.cn-shenzhen.nas.aliyuncs.com:/ /code/wordpress/wp-content/uploads nfs
defaults 0 0

4 快照与自定义镜像

4.1 快照







4.2 查看镜像

4.3 基于镜像创建新实例



4.4 负载均衡SLB







posted @ 2020-08-20 00:17  michaelni  阅读(252)  评论(0编辑  收藏  举报