阿里云服务器安装相应环境

阿里云服务器安装相应环境

安装docker:

安装所需要的依赖:

yum install -y yum-utils device-mapper-persistent-data lvm2

配置yum源 使用国内的:

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

查看docker版本:

yum list docker-ce --showduplicates | sort -r

安装最新稳定版:

yum install docker-ce -y

或安装指定版本,比如:

yum -y install docker-ce-3:20.10.6-3.el7

启动docker:

systemctl start docker

对docker设置开机自启:

systemctl enable docker

查看docker 启动状态:

systemctl status docker

停止docker:

systemctl stop docker

重启docker:

systemctl restart docker

查看容器:

docker ps

docker安装mysql:

拉取mysql最新镜像:

docker pull mysql

docker启动mysql:

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root1234 -d mysql

进入容器:

docker exec -it mysql bash

登录mysql:

mysql -u root -p

添加远程登录用户:

CREATE USER 'yunkeyo'@'%' IDENTIFIED WITH mysql_native_password BY 'yunkeyo123456!';

赋予该远程用户所以权限:

GRANT ALL PRIVILEGES ON *.* TO 'yunkeyo'@'%';

刷新数据库:

flush privileges;

docker安装nacos:

拉取nacos最新镜像:

docker pull nacos/nacos-server

在下面网址去复制sql,用nacos连接mysql启动:

https://github.com/alibaba/nacos/blob/master/config/src/main/resources/META-INF/nacos-db.sql

docker配置nacos启动:

docker run -d \
-v /data/nacos/logs:/home/nacos/logs \
-e TZ="Asia/Shanghai" \
-e PREFER_HOST_MODE=yunkeyo \
-e MODE=standalone \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST=172.16.3.255 \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_USER=yunkeyo \
-e MYSQL_SERVICE_PASSWORD=yunkeyo123456! \
-e MYSQL_SERVICE_DB_NAME=nacos \
-e MYSQL_SERVICE_DB_PARAM= \
-e NACOS_APPLICATION_PORT=8848 \
-p 8848:8848 \
--name nacos \
--restart=always \
nacos/nacos-server:latest

访问地址:

http://ip:8848/nacos


docker安装redis:

拉取redis最新镜像:

docker pull redis

docker配置redis启动:

docker run -p 6379:6379 --name redis  -v /root/dockerConfig/redis/redis.conf:/etc/redis/redis.conf -v /root/dockerConfig/redis/data:/data -d redis redis-server /etc/redis/redis.conf  --appendonly yes  --requirepass yunkeyo123456!

docker安装oracle:

拉取oracle最新镜像:

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

docker配置oracle启动:

docker run -d -it -p 1521:1521 \
--name oracle \
--restart=always \
--mount source=oracle_vol,target=/root/dockerConfig/oracle/data registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

后续操作参考下列网址:

https://blog.csdn.net/weixin_43224306/article/details/124892121

oracle用户权限的一些操作:

alter user system identified by "yunkeyo123456!";
alter user sys identified by "yunkeyo123456!";
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;

create user sysdba identified by "yunkeyo123456!";
grant connect,resource,dba to sysdba;

挂载文件启动mysql8:

docker run -d -v /root/dockerConfig/mysql8/conf/my.cnf:/etc/my.cnf -v /root/dockerConfig/mysql8/logs:/logs -v /root/dockerConfig/mysql8/data/mysql:/var/lib/mysql  -p 3306:3306 --name mysql8 -e MYSQL_ROOT_PASSWORD=yunkeyo123456! mysql:latest

docker查看容器日志:

docker logs --tail=1000 mysql8

安装git:

方式一:yum安装git

yum -y install git

方式二:从GitHub上下载最新的源码编译后安装

GutHub上的地址:https://github.com/git/git/tags

下载文件后,把文件放到服务器上,将文件进行解压:

tar -zxvf git-2.37.3.tar.gz

进入解压后的文件夹:

cd git-2.37.3

安装编译git源码所需要的依赖:

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

编译git源码:

make prefix=/usr/local/git all
make prefix=/usr/local/git install

编辑环境变量:

vim /etc/profile 

在末尾加上:export PATH=$PATH:/usr/local/git/bin

刷新环境变量:

source /etc/profile

查看git是否安装成功:

git --version

安装Maven:

进入官网下载页面下载:https://maven.apache.org/download.cgi

下载后放入服务器中解压:

tar -zxvf apache-maven-3.8.6-bin.tar.gz

进入 /etc/profile 配置环境变量:

MAVEN_HOME=/usr/local/java/apache-maven-3.8.6
PATH=$MAVEN_HOME/bin:$PATH
export PATH MAVEN_HOME

使配置生效并查看是否安装成功:

source /etc/profile
mvn -v

docker安装jenkins:

拉取最新jenkins镜像:

docker pull jenkins/jenkins

通过docker启动jenkins:

docker run \
  -m 1G \
  -d \
  --name jenkins \
  -p 9999:8080 \
  -p 50000:50000 \
  -v /usr/local/java/jdk-11.0.16.1:/opt/java/jdk-11.0.16.1 \
  -v /usr/local/java/apache-maven-3.8.6:/opt/apache-maven-3.8.6 \
  -v /root/dockerConfig/jenkins/jenkins_home:/var/jenkins_home \
  jenkins/jenkins:latest

修改 为 清华大学官方镜像:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

vim hudson.model.UpdateCenter.xml

你可能感兴趣的:(服务器,阿里云,服务器,docker,redis,mysql)