十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
> cat /etc/kylin-build
Kylin-Desktop V10-SP1
Build 20220316
> cat /etc/.kyinfo
[dist]
name=Kylin
milestone=Desktop-V10-SP1-General-RC6-Build21-2203
arch=arm64
beta=False
time=2022-03-16 16:54:55
dist_id=Kylin-Desktop-V10-SP1-General-RC6-Build21-2203-arm64-2022-03-16 16:54:55
[servicekey]
key=0316010
[os]
to=
term=2023-06-20
> cat /proc/version
Linux version 5.4.18-53-generic (buildd@localhost) (gcc version 9.3.0 (Ubuntu 9.3.0-10kylin2)) #42-KYLINOS SMP Fri Mar 4 06:09:02 UTC 2022
> uname -a
Linux kylin-mcbfb02 5.4.18-53-generic #42-KYLINOS SMP Fri Mar 4 06:09:02 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
> cat /etc/issue
Kylin V10 SP1 \n \l
> lsb_release -a
No LSB modules are available.
Distributor ID: Kylin
Description: Kylin V10 SP1
Release: v10
Codename: kylin
> whereis docker
docker: /etc/docker # 可能是之前使用的公司没有删除干净
> sudo rm -rf /etc/docker # 删掉未删除的docker程序包或配置文件
> whereis docker
docker:
sudo apt-get clean
# 卸载本机的mysql,自己鉴别是否需要执行,sudo apt-get purge -y 'mysql*'
sudo apt-get update
#卸载docker
dpkg -l | grep docker
sudo apt remove -y --purge xxx #上面的输出
# 下面的语句也可以试一下
sudo apt-get remove docker
sudo apt remove docker-ce
# 安装docker
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# 下载mysql镜像
docker pull mysql
# 如果下载镜像失败,则需要从其他服务器先执行 下面操作在其他服务器
docker pull mysql
docker save -o mysql.tar mysql
# 使用xftp将mysql.tar文件下载下来,然后上传到麒麟linux的/home/kylin/SC/docker目录
# 下面操作在麒麟服务器
cd /home/kylin/SC/docker
docker load < mysql.tar
docker load < busterslim.tar
# 先运行ysql,将里面的配置文件和data映射到本地 mysql密码不能用大写,不能用特殊字符
# mysql 8.0的配置文件路径是/etc/mysql/conf.d,data文件路径是/var/lib/mysql
cd /home/kylin/SC/mysql && rm -rf conf.d && rm -rf data
docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=你的密码 --name t_mysql mysql --lower_case_table_names=1
docker exec -it t_mysql /bin/bash
mysql -u root -p
show global variables like '%lower_case%'; #查看是否大小写敏感
show variables like '%time_zone%'; # 查看时区
set global time_zone = '+8:00';
set time_zone = '+8:00';
flush privileges;
show variables like '%time_zone%';
docker cp t_mysql:/etc/mysql/conf.d /home/kylin/SC/mysql/conf.d
docker cp t_mysql:/var/lib/mysql /home/kylin/SC/mysql/data
#然后停止并删除之前的mysql
docker stop $(docker ps -aqf "name=t_mysql") && docker rm $(docker ps -aqf "name=t_mysql")
# 再运行mysql,此时将映射添加上
docker run -d \
-p 3306:3306 \
--name mysql \
-v /home/kylin/SC/mysql/conf.d:/etc/mysql/conf.d \
-v /home/kylin/SC/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=你的密码 \
--restart always \
mysql --lower_case_table_names=1
docker exec -it mysql /bin/bash
docker ps -a
docker stop $(docker ps -aqf "name=mysql")
docker rm $(docker ps -aqf "name=mysql")
sudo dockerd --debug
vim /etc/default/grub
# 修改GRUB_CMDLINE_LINUX_SECURITY="audit=0 security="为GRUB_CMDLINE_LINUX_SECURITY="audit=0 security=kesec"
update-grub
reboot
#安装curl
sudo apt-get -y install curl
# 下载并安装.net 5 运行时
mkdir /home/kylin/SC && cd /home/kylin/SC
# 下载.net 5 运行时 或者使用文件传输工具将压缩包上传到linux
wget https://download.visualstudio.microsoft.com/download/pr/6eb8aee2-cbea-4c4f-9bb9-ea6229ec229b/d6c438e5071c359ad995134f0a33e731/aspnetcore-runtime-5.0.17-linux-arm64.tar.gz
# 压缩并添加环境变量
mkdir -p "$HOME/dotnet" && tar zxf aspnetcore-runtime-5.0.17-linux-arm64.tar.gz -C "$HOME/dotnet"
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
cd /etc/systemd/system/ && sudo cat << EOF > net-webadmin.service
[Unit]
Description=webadmin .NET Web API App running on Ubuntu
[Service]
WorkingDirectory=/home/kylin/SC/api/webadmin
ExecStart=/home/kylin/dotnet/dotnet /home/kylin/SC/api/admin/WebApi.dll --urls http://0.0.0.0:8000
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
SyslogIdentifier=dotnet-web api
User=kylin
Environment=ASPNETCORE_ENVIRONMENT=Development
[Install]
WantedBy=multi-user.target
EOF
# The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.
# https://blog.csdn.net/small_kidy/article/details/118933366
# 可以使用这个命令进行测试 /home/kylin/dotnet/dotnet /home/kylin/SC/api/webadmin/CMTMC.AdminWebApi.dll
# 刷新配置
systemctl daemon-reload
# 设置开机启动
systemctl enable net-webadmin.service
# 重启
systemctl restart net-webadmin.service
# 查看状态
systemctl status net-webadmin.service
# 停止
systemctl stop net-webadmin.service
# 启动
systemctl start net-webadmin.service
systemctl disable net-webadmin.service
# 安装nginx
# nginx
mkdir nginx && cd nginx
sudo apt-get install -y nginx
nginx -v
# 输出1.18.0
sudo service nginx start
# 彻底卸载 apt-get --purge autoremove nginx
# nginx文件安装完成之后的文件位置
#/usr/sbin/nginx:主程序
#/etc/nginx:存放配置文件
#/usr/share/nginx:存放静态文件
#/var/log/nginx:存放日志
# 上创nginx的conf文件路径/etc/nginx/conf.d/sc.conf
# 需要使用root
# 使用root更改sc.conf配置
sudo cd /etc/nginx/conf.d && cat << EOF > sc.conf
server {
listen 8000;
location / {
root /home/kylin/SC/web/webadmin;
index index.html index.htm;
}
}
server {
listen 9001;
location / {
root /home/kylin/SC/web/web;
index index.html index.htm;
}
}
EOF
# 使用kylin
vim /etc/nginx/nginx.conf
#按i键开始修改,把第一行的user www-data;更改为user kylin;然后按esc键,输入:wq保存并退出
# 更改配置文件后刷新nginx
sudo nginx -s reload