更新时间:2021-10-18 15:49:08
Passw0rd
ssh 用户名/密码@弹性ip地址
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
看到以下的输出说明安装成功了
systemctl start httpd.service
rpm -e mariadb-libs --nodeps
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm
mysql -V
命令查看MySQL版本号,如能正确显示说明安装成功。systemctl start mysqld.service
grep "password" /var/log/mysqld.log
你会看到类似如下输出,加粗部分就是初始密码。
2022-01-18T07:31:17.961057Z 1 [Note] A temporary password is generated for root@localhost: H:-oYBiAy1X4
mysql -u用户名 -p密码
命令登录数据库。mysql -uroot -pH:-oYBiAy1X4
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
此处我把密码修改为12345678
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '12345678';
quit
命令退出MySQL命令行,回到Linux终端。yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
systemctl restart httpd
http://<公网ip>/phpinfo.php
,如能显示PHP版本信息则安装成功。phpMyAdmin是一个MySQL数据库管理工具,通过Web接口管理数据库方便快捷。
mkdir -p /var/www/html/phpmyadmin
wget --no-check-certificate https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip
yum install -y unzip
unzip phpMyAdmin-4.0.10.20-all-languages.zip
mv phpMyAdmin-4.0.10.20-all-languages/* /var/www/html/phpmyadmin
http://<公网ip>/phpmyadmin
,如能显示登录页面说明安装成功。
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-community-server --nogpgcheck
mysql -V
命令,能显示MySQL版本说明安装成功。root@localhost: RTH=js8DK9ak
mysql_secure_installation
通常情况下,不建议允许root用户远程登录数据库。因此此处先通过root用户在本地登录,创建一个用于远程访问的用户。
mysql -uroot -p密码
命令在终端登录数据库。create user 'anony'@'%' identified by 'Aa.123456'; grant all privileges on . to 'dms'@'%'with grant option; flush privileges;
Docker有两个分支版本:Docker CE和Docker EE,即社区版和企业版。
这一部分所有内容都在Workbench完成。
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
若能看到如下输出说明安装成功
systemctl start docker
Docker的默认官方远程仓库是hub.docker.com,由于网络原因,下载一个Docker官方镜像可能会需要很长的时间,甚至下载失败。为此,阿里云容器镜像服务ACR提供了官方的镜像站点,从而加速官方镜像的下载。
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://kena6qwk.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
docker pull nginx:latest
docker images
docker run --name nginx-test -p 8080:80 -d nginx
PS:运行命令的参数说明
http://ECS公网ip地址:8080
,即可访问Nginx服务。
LAMP是指运行在Linux下的Apache、MySQL和PHP的环境。参考以下操作在云服务器上安装开发环境。
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
rpm -e mariadb-libs --nodeps
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm
systemctl start mysqld
yum -y install git
cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git
cp -r PbootCMS/* /var/www/html/
chmod -R a+w /var/www/html
sql_file="/var/www/html/static/backup/sql/"$(ls /var/www/html/static/backup/sql/) && mysql -hpc-bp12l6xxp5v647947.mysql.polardb.rds.aliyuncs.com -utest_user -pPassword1213 -Dpbootcms < $sql_file
数据库连接地址参在集群详情页面下方可以看到。
cat > /var/www/html/config/database.php << EOF
<?php
return array(
'database' => array(
'type' => 'mysqli', // 数据库连接驱动类型: mysqli,sqlite,pdo_mysql,pdo_sqlite
'host' => 'pc-bp12l6xxp5v647947.mysql.polardb.rds.aliyuncs.com', // PolarDB数据库链接地址
'user' => 'test_user', // PolarDB数据库的用户名
'passwd' => 'Password1213', // PolarDB数据库的密码
'port' => '3306', // 数据库端口
'dbname' => 'pbootcms' //数据库名称
)
);
EOF
systemctl restart httpd
http://<ECS公网IP地址>/admin.php
,默认账户admin,密码123456。公网ip在云体验资源中查看。