文章目录
- 一、Linux常见命令记录
- 1. 为普通用户赋sudo权限
- 2. Kylin系统yum配置以及使用
- 2.1 Kylin操作系统yum源配置(本地yum源)
- 2.1.1 `.repo`类型文件存在
- 2.1.2 `.repo`类型文件不存在
- 2.1.3 挂载OS镜像文件
- 2.1.4 编辑local.repo文件,创建yum源地址
- 2.1.5使yum源生效
- 2.2 yum命令
- 2.2.1 使用yum命令只下载安装包而不安装(安装包未安装)
- 2.2.2 使用yum命令只下载安装包而不安装(安装包已安装)
- 二、安装MySQL8常见问题
- 1. libncurses.so.5: cannot open shared object file: No such file or directory
- 2. libtinfo.so.5: cannot open shared object file: No such file or directory
- 三、安装Nginx常见问题
- 1. configure: error: in `~/nginx/pcre-8.42':
- 2. ./InstallNginx.sh:行102: make: 未找到命令
- 3. pcrecpp.cc:43:10: 致命错误:string:没有那个文件或目录
- 4. 以上问题离线解决
一、Linux常见命令记录
1. 为普通用户赋sudo权限
# 1. 登录root用户用以下命令打开sudo配置文件
visudo
# 2. 在文件中找到以下行
root ALL=(ALL) ALL
# 3. 在此行下面新增需要创建用户的sudo权限
username ALL=(ALL) ALL
# 4. 保存并关闭visudo配置文件
linux在文档中查找某一关键字步骤为:visudo -> /root(回车键) -> n(依次查找)
2. Kylin系统yum配置以及使用
2.1 Kylin操作系统yum源配置(本地yum源)
首先查看/etc/yum.repos.d/
目录下是否存在.repo
类型文件
2.1.1 .repo
类型文件存在
- 查看yum源
ls /etc/yum.repos.d
- 备份yum源
cd /etc/yum.repos.d mkdir bak mv *.repo bak
2.1.2 .repo
类型文件不存在
- 建目录,创文件
mkdir yum.repos.d
touch local.repo
2.1.3 挂载OS镜像文件
- 上传镜像文件至
root根目录
下 - 挂载镜像
查看OS镜像对应的设备符号
ls /dev/sr*
# 此系统显示 dev/sr0
将OS镜像文件挂载至/mnt
目录下
mount /root/Kylin-Server-10-8.2-Release-Build09-20211104-X86_64.iso /mnt
# 返回 mount: /mnt: WARNING: source write-protected, mounted read-only 说明挂载成功
执行以下命令查看挂载详情
# dev/sr0 与OS镜像文件的设备号保持一致
mount /dev/sr0 /mnt
df -h | grep /mnt
ls /mnt
2.1.4 编辑local.repo文件,创建yum源地址
在local.repo文件中添加如下内容:
[local.repo]
name=local.repo
baseurl=file:///mnt
enabled=1
gpgcheck=0
附: 其他yum(依据操作系统版本精准匹配),直接添加至local.repo 根据实际情况添加
[AppStream]
name = Kylin AppStream
baseurl = https://update.cs2c.com.cn/NS/V10/8U2/os/adv/lic/AppStream/$basearch/
gpgcheck = 0
enabled = 1[AppStream-updates]
name = Kylin AppStream-updates
baseurl = https://update.cs2c.com.cn/NS/V10/8U2/os/adv/lic/AppStream-updates/$basearch/
gpgcheck = 0
enabled = 1[BaseOS]
name = Kylin BaseOS
baseurl = https://update.cs2c.com.cn/NS/V10/8U2/os/adv/lic/BaseOS/$basearch/
gpgcheck = 0
enabled = 1[BaseOS-updates]
name = BaseOS-updates
baseurl = https://update.cs2c.com.cn/NS/V10/8U2/os/adv/lic/BaseOS-updates/$basearch/
gpgcheck = 0
enabled = 1
2.1.5使yum源生效
yum clean all
yum makecache
yum list
2.2 yum命令
2.2.1 使用yum命令只下载安装包而不安装(安装包未安装)
sudo yum -y install --downloadonly --downloaddir=/path/to/directory package-name
命令解析
- sudo: 以超级用户身份运行命令,以便获得必要的权限。
- yum: 包管理器工具的名称,用于管理和安装软件包。
- install: yum操作命令,用于安装软件包。
- –downloadonly: 指定仅下载软件包,而不进行安装。
- –downloaddir: 指定下载软件包的目标目录。将/path/to/directory替换为您要下载软件包的目标目录的路径。
- package-name: 指定要下载的软件包的名称。
2.2.2 使用yum命令只下载安装包而不安装(安装包已安装)
当安装包已安装的情况下,上面的命令是不能下载安装包及相关依赖的,此时就要用到下面这个命令:
sudo yum reinstall --downloadonly --downloaddir=/path/to/directory package-name
命令解析
- reinstall: yum操作命令,用于重新安装软件包。
二、安装MySQL8常见问题
1. libncurses.so.5: cannot open shared object file: No such file or directory
问题描述:
/home/zhh/app/mysql/bin/mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
解决方法:
# 查找是否含有libncurses.*文件
sudo find / -name libncurses.*
# 如果能查到相应文件
/usr/lib64/libncurses.so.6
/usr/lib64/libncurses.so.6.1# 执行以下命令解决此问题
cd /usr/lib64
sudo ln -s libncurses.so.6 libncurses.so.5
2. libtinfo.so.5: cannot open shared object file: No such file or directory
问题描述:
/home/zhh/app/mysql/bin/mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
解决方法:
# 查找是否含有libtinfo.*文件
sudo find / -name libtinfo.*
# 如果能查到相应文件
/usr/lib64/libtinfo.so.6
/usr/lib64/libtinfo.so.6.1# 则执行下面命令,解决此问题
cd /usr/lib64
sudo ln -s libtinfo.so.6 libtinfo.so.5
三、安装Nginx常见问题
1. configure: error: in `~/nginx/pcre-8.42’:
问题描述:
checking whether the C compiler works... no
configure: error: in `~/nginx/pcre-8.42':
configure: error: C compiler cannot create executables
See `config.log' for more detail# 日志文件config.log 中提示:
gcc: error trying to exec 'as': execvp: No such file or directory
configure:3855: $? = 1
configure:3893: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PCRE"
| #define PACKAGE_TARNAME "pcre"
| #define PACKAGE_VERSION "8.42"
| #define PACKAGE_STRING "PCRE 8.42"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "pcre"
| #define VERSION "8.42"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
解决方法:
# 下载安装binutils即可解决
sudo yum -y install binutils
2. ./InstallNginx.sh:行102: make: 未找到命令
问题描述:
---------------编译pcre-8.42
./InstallNginx.sh:行102: make: 未找到命令
xxxxxxxxxxxxxxxpcre-8.42编译失败
解决方法:安装make命令
sudo yum -y install make
3. pcrecpp.cc:43:10: 致命错误:string:没有那个文件或目录
问题描述:
pcrecpp.cc:43:10: 致命错误:string:没有那个文件或目录#include <string>^~~~~~~~
编译中断。
make[1]: *** [Makefile:2255:libpcrecpp_la-pcrecpp.lo] 错误 1
make: *** [Makefile:1322:all] 错误 2
xxxxxxxxxxxxxxxpcre-8.42编译失败
解决方法:gcc、g++安装有问题,重新安装
sudo yum -y install gcc
sudo yum -y install gcc-c++
4. 以上问题离线解决
找一个能下载安装包的服务器,先将安装包以及依赖下载下来,然后拿到需要的地方自己安装,以安装gcc为例:
- 下载安装包
sudo yum -y install --downloadonly --downloaddir=/home/zhh/software/gcc gcc
- 安装安装包
cd /home/zhh/software/gcc
sudo rpm -ivh *.rpm