8.1 配置仓库
1.配置本地仓库
#进行代码安装前需要先进行仓库配置和挂载
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vim base.repo
[baseos]
name=baseos
baseurl=/mnt/BaseOS
gpgcheck=0
[appstream]
name=appstream
baseurl=/mnt/AppStream
gpgcheck=0
测试:使用dnf/yum命令安装httpd功能
#使用dnf命令安装httpd
[root@localhost ~]# dnf -y install httpd
Complete!
2.配置网络仓库
#以阿里云为例:
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vim base.repo
[baseos]
name=baseos
baseurl=https://mirrors.aliyun.com/redhat/rhel/rhel-9-beta/baseos/x86_64/
gpgcheck=0
[appstream]
name=appstream
baseurl=https://mirrors.aliyun.com/redhat/rhel/rhel-9-beta/appstream/x86_64/
gpgcheck=0
测试:使用dnf/yum命令安装httpd功能
[root@localhost ~]# dnf -y install httpd
Complete!
3.挂载
#临时挂载
[root@localhost yum.repos.d]# mount /dev/sr0
mount: /mnt: /dev/sr0 already mounted on /mnt.
#永久挂载
[root@localhost ~]# vim /etc/fstab
/dev/sr0 /mnt iso9660 defaults 0 0
8.2 源码安装
以MySQL安装为例:
1.下载源码
1.在浏览器输入:www.mysql.com
2.点击:DOWNLOADS -下滑点击:MySQL Community Downloads
3.点击:MySQL Community Server
4.完成规定操作,点击Download
5.点击download下载tar包
2.安装源码
1.把下载的tar包装进虚拟机里并进行解压缩操作
#使用rz -E指令将Windows中命令传输到虚拟机中
[root@localhost ~]# rz -E
#使用sz命令可以将虚拟机中文件传输到Windows中
[root@localhost ~]# sz 文件名
#查看文件传输所需软件包(没有的话需要下载)
[root@localhost ~]# rpm -qa |grep lrz
lrzsz-0.12.20-55.el9.x86_64
#解压tar包
[root@localhost ~]# tar -zxvf mysql-9.1.0.tar.gz
#将tar包和解压后的目录存放到新建目录,便于后续操作
[root@localhost ~]# mkdir -p ./mysql
[root@localhost ~]# mv mysql-9.1.0 mysql-9.1.0.tar.gz ./mysql
2.进入解压包,查看安装手册
#进入目录
[root@localhost ~]# cd mysql/
#进入解压包
[root@localhost mysql]# cd mysql-9.1.0/
#查看安装手册
[root@localhost mysql-9.1.0]# ll
-rw-r--r--. 1 7161 31415 333 Sep 24 19:37 INSTALL
[root@localhost mysql-9.1.0]# cat INSTALL
You can find information about how to install from a source distribution at
http://dev.mysql.com/doc/refman/8.0/en/source-installation.html
3.在浏览器中输入安装手册网址-多次下滑点击 NEXT>
4.回到虚拟机继续完成安装操作
#创建bld目录
[root@localhost mysql-9.1.0]# mkdir bld
#进入bld目录
[root@localhost mysql-9.1.0]# cd bld
#执行cmake ..命令
[root@localhost bld]# cmake ..
bash: cmake: command not found...
Install package 'cmake' to provide command 'cmake'? [N/y]
5.安装cmake服务
[root@localhost bld]# dnf -y install cmake
Complete!
6.继续执行cmake命令
[root@localhost bld]# cmake ..
#被告知需要安装需求包
CMake Warning at CMakeLists.txt:398 (MESSAGE):
You need to install the required packages:
yum install gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ gcc-toolset-13-binutils gcc-toolset-13-annobin-annocheck gcc-toolset-13-annobin-plugin-gcc
CMake Error at CMakeLists.txt:400 (MESSAGE):
Or you can set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER explicitly.
7.安装需求包
#先安装C语言编译环境
[root@localhost bld]# dnf install -y make gcc*
#安装需求包
[root@localhost bld]# yum install gcc-toolset-13-gcc gcc-toolset-13-gcc-c++
gcc-toolset-13-binutils gcc-toolset-13-annobin-annocheck gcc-toolset-13-
annobin-plugin-gcc
8.继续执行cmake命令
[root@localhost bld]# cmake ..
#错误,请先安装需求包
CMake Error at cmake/ssl.cmake:85 (MESSAGE):
Please install the appropriate openssl developer package.
9.安装需求包
#在系统中查找需求包
[root@localhost bld]# dnf list |grep openssl-devel
openssl-devel.i686 1:3.0.7-24.el9 appstream
openssl-devel.x86_6 1:3.0.7-24.el9 appstream
#安装需求包
[root@localhost bld]# dnf -y install openssl-devel
Complete!
10.再次执行cmake命令
#执行cmake命令
[root@localhost bld]# cmake ..
#错误,需要先安装需求包
CMake Error at cmake/readline.cmake:93 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is
libncurses5-dev, on Redhat and derivates it is ncurses-devel.
11.安装需求包
[root@localhost bld]# dnf -y install ncurses-devel
12.再次执行cmake命令
#再次执行cmake命令
[root@localhost bld]# cmake ..
#错误,需安装需求包
CMake Warning at cmake/rpc.cmake:41 (MESSAGE):
Cannot find RPC development libraries. You need to install the required
packages:
RedHat/Fedora/Oracle Linux: yum install libtirpc-devel
13.安装需求包
[root@localhost bld]# yum install libtirpc-devel
#
马上更新。。。。