麒麟系统安装docker、mysql、clickhouse

发布时间:2024年01月10日

1、查看麒麟系统版本信息

cat /etc/os-release

麒麟系统版本V10

64位操作系统
# uname -p
x86_64

# uname -p
aarch64

内核版本
# uname -r
4.19.90-24.4.v2101.ky10.x86_64

本操作为麒麟系统版本V10,x86_64操作系统

一,安装docker

? 文件:

docker-compose-linux-x86_64

docker-19.03.0.tgz

arm下载地址:

Index of linux/static/stable/aarch64/

deb下载地址(我们下载这个):

https://download.csdn.net/download/weixin_60748184/88717628?spm=1001.2014.3001.5503

https://download.csdn.net/download/CSDNCDN/87704041

Index of /NS/V10/V10SP1/os/adv/lic/base/x86_64/Packages/

1、将docker-compose-linux-x86_64拷贝到/usr/local/bin并重命名为docker-compose

cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod 777 /usr/local/bin/docker-compose

2、解压压缩包docker-19.03.0.tgz并移动到/usr/bin下

tar -zxvf ?docker-19.03.0.tgz
cp  -p docker/* /usr/bin/
cp docker.service /usr/lib/systemd/system/
cp containerd.service /usr/lib/systemd/system/
cp docker.socket /usr/lib/systemd/system/

chmod +x /usr/lib/systemd/system/docker.service
5.文件生效
systemctl daemon-reload
6.设置开机启动
systemctl enable docker
7.启动docker 
systemctl start docker

8、查看docker版本
docker -v

9、查看docker-compose版本

docker-compose -v

删除docker

1、停止docker服务
systemctl stop docker.socket
systemctl stop docker.service

2、删除配置文件
rm -f /etc/systemd/system/docker.service
rm -rf /usr/bin/docker*
rm -f /usr/local/bin/docker-compose
systemctl daemon-reload

二、安装mysql

安装5.7.22版本mysql

文件:

mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar

下载地址(以下是rpm安装,源码安装需要基础包,安装时间很慢,就不验收源码安装了):

MySQL :: Download MySQL Community Server (Archived Versions)

1、解压mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
tar -zxvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar

2、解压后有以下rpm文件
mysql-community-client-5.7.22-1.el7.x86_64.rpm
mysql-community-common-5.7.22-1.el7.x86_64.rpm
mysql-community-devel-5.7.22-1.el7.x86_64.rpm
mysql-community-embedded-5.7.22-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.22-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.22-1.el7.x86_64.rpm
mysql-community-libs-5.7.22-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.22-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.22-1.el7.x86_64.rpm
mysql-community-server-5.7.22-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.22-1.el7.x86_64.rpm
mysql-community-test-5.7.22-1.el7.x86_64.rpm

3、安装必要的rpm(执行顺序不能乱)
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.22-1.el7.x86_64.rpm

4、2.查看mysql服务
mysql --version

5.添加mysql用户
mkdir -p /home/mysql
chown mysql:mysql /home/mysql
useradd -m mysql -s /bin/bash -d /home/mysql

6、初始化mysql
chown -R mysql:mysql /home/mysql
sed -i 's#datadir=/var/lib/mysql#datadir=/home/mysql/data#g' /etc/my.cnf
mysqld --initialize  --user=mysql
service mysqld start

7、显示初始密码
grep 'temporary password' /var/log/mysqld.log

8、修改密码
password=`grep 'temporary password' /var/log/mysqld.log | awk -F ": " '{print $2}' |tail -n 1`
sleep 5
mysql --connect-expired-password -u root -p$password<<EOF
SET PASSWORD FOR 'root'@'localhost'= "123qwe";
use mysql;
update user set host='%' where user='root';
update user set password_expired='N' where user='root';
flush privileges;
quit
EOF









删除mysql

1、停服务
systemctl stop mysqld

2、使用 rpm -qa | grep mysql 指令来显示系统中是否安装有mysql的软件包

rpm -qa | grep mysql


3、如果有的话,则使用 rpm -qa | grep mysql | xargs yum -y remove 指令将全部的安装包删除。
xargs指令的作用是将前面的数据一条一条“喂给”后面的指令,从而达到批量操作的目的。注意 -y 不能省略,否则在批量处理时会出错

rpm -qa | grep mysql | xargs yum -y remove

rpm -qa | grep mariadb
rpm -qa | grep mariadb | xargs yum -y remove

4、删除残留文件
rm -rf  /etc/my*
rm  -rf /home/mysql/
rm -rf  /var/lib/mysql
rm -rf  /usr/share/mysql
rm -rf /var/log/mysqld.log
rm -rf /usr/bin/mysql
rm -rf  /usr/lib64/mysql
rm -rf  /usr/include/mysql
rm -rf  /usr/share/man/man1/mysql.1.gz

三、安装clickhouse

文件:

clickhouse-common-static-23.12.1.1368.x86_64.rpm

clickhouse-client-23.12.1.1368.x86_64.rpm

clickhouse-server-23.12.1.1368.x86_64.rpm

参考地址;

https://clickhouse.com/docs/zh/getting-started/install

临时下载clickhouse指定版本到指定目录

yum install --downloadonly ?--downloaddir=/home/ppp/ck clickhouse-server clickhouse-client
yum install --downloadonly ?--downloaddir=/home/ppp/ck clickhouse-server-23.10.1.1976
yum install --downloadonly ?--downloaddir=/home/ppp/ck clickhouse-client-23.10.1.1976

rpm -ivh clickhouse-common-static-23.12.1.1368.x86_64.rpm
rpm -ivh clickhouse-server-23.12.1.1368.x86_64.rpm
rpm -ivh clickhouse-client-23.12.1.1368.x86_64.rpm

1、设置clickhouse的8123端口可以让任意机器访问
/etc/clickhouse-server/config.xml
将config.xml中的<listen_host>0.0.0.0</listen_host> 注释解除掉,然后重启clickhouse-server即可

sed -i "s:<!-- <listen_host>0.0.0.0</listen_host> -->:<listen_host>0.0.0.0</listen_host>:" /etc/clickhouse-server/config.xml

安装好后查看status
systemctl status clickhouse-server


启动
systemctl start clickhouse-server


停止
systemctl stop clickhouse-server

进clickhouse客户端
clickhouse-client

删除clickhouse

1.停服务
service clickhouse-server stop

2.检查有哪些clickhouse依赖包:

 yum list installed | grep clickhouse

例如:依赖的包有clickhouse-common-static

3.移除依赖包:

yum remove -y clickhouse-common-static

4.卸载完再确认一下是否卸载干净

yum list installed | grep clickhouse 

5.删除相关配置文件 

rm -rf /var/lib/clickhouse
rm -rf /etc/clickhouse-*
rm -rf /var/log/clickhouse-server
rm -rf /home/clickhouse/*
rm -rf /var/run/clickhouse-server/*

麒麟系统下载rpm包地址

Index of linux/static/stable/x86_64/

文章来源:https://blog.csdn.net/weixin_60748184/article/details/135461707
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。