安装的软件包若有bin文件,说明它是一个二进制文件,它已经被编译成功了,可以直接使用。若有source文件,说明是源码包,需要编译。Linux中就这两种包
源码包的优点:开源,可以修改源码
可以自由选择需要的功能
软件是编译安装,可以更加适合自己的系统,更稳定,效率更高
卸载方便
源码包的缺点:安装步骤多,在安装大软件集合时,容易出现拼写错误
. / configure -prefix = / usr /local / python
Make && make install
安装时间比二进制包的时间长
因为是编译,安装报错难以解决
[root@es_005 ~]# yum list | grep python3
[root@es_005 ~]# rz -E // 下载源码(python3.12.4官网)tgz
[root@es_005 ~]# ls
[root@es_005 ~]# tar -zxvf Python-3.12.4.tgz // 解压软件包
[root@es_005 ~]# ls // 在解压后的目录中找到configure可执行文件
[root@es_005 ~]# cd Python-3.12.4/ // 进入目录,运行make,编译编码
[root@es_005 Python-3.12.4]# ls
[root@es_005 Python-3.12.4]# ./configure -prefix=/usr/local/python3124 // 欧洲安装路径:/root/python312.4/configure -prefix = /usr/local/python3214
[root@es_005 Python-3.12.4]# ls
[root@es_005 Python-3.12.4]# make
[root@es_005 Python-3.12.4]# make install
[root@es_005 Python-3.12.4]# yum -y install gcc
[root@es_005 Python-3.12.4]# ls
[root@es_005 Python-3.12.4]# ls /usr/local/
[root@es_005 Python-3.12.4]# cd /usr/local/
[root@es_005 local]# cd python3124/bin/
[root@es_005 bin]# ls
[root@es_005 bin]# ./python3.12
Python 3.12.4 (main, Jul 10 2024, 09:59:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
二进制包,直接运行
[root@es_005 bin]# vim /etc/profile
[root@es_005 bin]# cat /etc/profile | tail -1
export PATH=/usr/local/python3124/bin/:$PATH
[root@es_005 bin]# source /etc/profile
[root@es_005 bin]# python3.12
Python 3.12.4 (main, Jul 10 2024, 09:59:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
网络配置
[root@es_005 ~]# ifconfig ens36 // 命令:ifconfig 网卡名 —— 查看指定网络接口信息
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.88 netmask 255.255.255.0 broadcast 192.168.119.255
inet6 fe80::fe78:a216:3aa2:fcfb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
// 设置网络接口的IP地址,子网掩码
[root@es_005 ~]# ifconfig ens36 192.168.119.77 netmask 255.255.255.0
[root@es_005 ~]# ifconfig ens36
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.77 netmask 255.255.255.0 broadcast 192.168.119.255
inet6 fe80::fe78:a216:3aa2:fcfb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
// ifconfig 网络接口 ip地址 【/子网掩码长度 】
[root@es_005 ~]# ifconfig ens36 192.168.119.66/24
[root@es_005 ~]# ifconfig ens36
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.66 netmask 255.255.255.0 broadcast 192.168.119.255
inet6 fe80::fe78:a216:3aa2:fcfb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
[root@es_005 ~]# ifconfig ens36 down // 禁用或重新激活网卡
[root@es_005 ~]# ifconfig ens36
ens36: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
[root@es_005 ~]# ifconfig ens36 up
[root@es_005 ~]# ifconfig ens36
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.88 netmask 255.255.255.0 broadcast 192.168.119.255
inet6 fe80::fe78:a216:3aa2:fcfb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
[root@es_005 ~]# ifdown ens36 // ifdown ens37彻底禁止网卡,临时网卡地址不存在
成功断开设备 'ens36'。
[root@es_005 ~]# ifconfig ens36
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
[root@es_005 ~]# ifup ens36 // ifup启动网卡以后需要重启
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/6)
[root@es_005 ~]# ifconfig ens36
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.88 netmask 255.255.255.0 broadcast 192.168.119.255
inet6 fe80::fe78:a216:3aa2:fcfb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e6:54:b5 txqueuelen 1000 (Ethernet)
RX packets 1481 bytes 90141 (88.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 52 bytes 3868 (3.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@es_005 ~]# ifconfig ens33:1 192.168.119.149
[root@es_005 ~]# ifconfig ens33:1
ens33:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.119.149 netmask 255.255.255.0 broadcast 192.168.119.255
ether 00:0c:29:e6:54:ab txqueuelen 1000 (Ethernet)
[root@es_005 ~]# hostname -I // 查看本主机IP
192.168.119.55
[root@es_005 ~]# hostnamectl set-hostname shark // 永久修改主机名称
[root@es_005 ~]# hostname
shark
[root@es_005 ~]# vim /etc/hostname // 修改配置文件
[root@es_005 ~]# cat /etc/hostname
Shark
安装和运行Redis,并且会简单的增删改查
[root@es_005 ~]# rz -E
rz waiting to receive.
[root@es_005 ~]# ls
anaconda-ks.cfg Python-3.12.4.tgz apache-tomcat-10.1.25.tar.gz
redis-6.2.14.tar.gz elasticsearch-7.17.8-x86_64.rpm todolist.jar
Python-3.12.4 jdk-22_linux-x64_bin.tar.gz
[root@es_005 ~]# tar -zxvf redis-6.2.14.tar.gz
[root@es_005 ~]# cd redis-6.2.14/
[root@es_005 redis-6.2.14]# ls
[root@es_005 redis-6.2.14]# make && make install
[root@es_005 redis-6.2.14]# redis-server
安装MongoDB(非关系型数据库:一条数据就是一个文档)
Nosql
非关系型数据库将所有数据保存在内存里面,更快
关系型数据库将数据保存在磁盘里面
启动方式,端口,logo
[root@es_002 ~]# mkdir /usr/local/mongodb
[root@es_002 ~]# rz -E
rz waiting to receive.
[root@es_002 ~]# tar -zxf mongodb-linux-x86_64-rhel70-3.6.3.tgz
[root@es_002 ~]# ls
anaconda-ks.cfg
elasticsearch-7.17.8-x86_64.rpm
mongodb-linux-x86_64-rhel70-3.6.3
mongodb-linux-x86_64-rhel70-3.6.3.tgz
[root@es_002 ~]# ls mongodb-linux-x86_64-rhel70-3.6.3
bin GNU-AGPL-3.0 MPL-2 README THIRD-PARTY-NOTICES
[root@es_002 ~]# ls mongodb-linux-x86_64-rhel70-3.6.3/bin/
bsondump mongodump mongoperf mongostat
install_compass mongoexport mongoreplay mongotop
mongo mongofiles mongorestore
mongod mongoimport mongos
[root@es_002 ~]# cp -r mongodb-linux-x86_64-rhel70-3.6.3/bin/ /usr/local/mongodb/
[root@es_002 ~]# cd /usr/local/mongodb/
[root@es_002 mongodb]# ls
bin
[root@es_002 mongodb]# mkdir etc
[root@es_002 mongodb]# mkdir log
[root@es_002 mongodb]# mkdir -p data/db
[root@es_002 mongodb]# vim /usr/local/mongodb/etc/mongodb.conf
[root@es_002 mongodb]# cat /usr/local/mongodb/etc/mongodb.conf
dbpath=/usr/local/mongodb/data/db
logpath=/usr/local/mongodb/log/mongodb.log
logappend=true
fork=true
bind_ip=192.168.119.22
[root@es_002 mongodb]# ps -C mongod
PID TTY TIME CMD
1677 ? 00:00:10 mongod
[root@es_002 mongodb]# netstat -utnalp | grep 27017
tcp 0 0 192.168.119.22:27017 0.0.0.0:* LISTEN 1677/mongod
tcp 0 0 192.168.119.22:49716 192.168.119.22:27017 TIME_WAIT -
[root@es_002 mongodb]# PATH=/usr/local/mongodb/bin:$PATH
[root@es_002 mongodb]# echo "PATH=/usr/local/mongodb/bin:$PATH" >> /etc/profile
[root@es_002 mongodb]# source /etc/profile
[root@es_002 mongodb]# echo $PATH
/usr/local/mongodb/bin:/usr/local/mongodb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@es_002 mongodb]# mongod -f /usr/local/mongodb/etc/mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 1677
child process started successfully, parent exiting
[root@es_002 mongodb]# mongo --host 192.168.119.22 --port 27017
MongoDB shell version v3.6.3
connecting to: mongodb://192.168.119.22:27017/
MongoDB server version: 3.6.3
Welcome to the MongoDB shell.
> db
test
> show dbs
admin 0.000GB
local 0.000GB
> use t1
switched to db t1
> exit
bye