拿到服务器做的事:自己写的最全的一个,方便后续使用

1、ssh密钥登录

1.1本机生成密钥

这里是windows的命令
在这里插入图片描述

1.2上传.pub文件到服务器端

服务器端的操作:
本机用记事本打开.pub文件,复制到服务器端
我这里是新建了一个hh文件,粘贴过去了

vim hh

在这里插入图片描述

1.3密钥写入到密钥key文件中

cat hh >>~/.ssh/authorized_keys

在这里插入图片描述
如果出错
在这里插入图片描述

ssh localhost

在这里插入图片描述

1.4 打开ssh中的密钥登录

vim /etc/ssh/sshd_config

修改:
1、将PubkeyAuthentication 前面的井号去掉

PubkeyAuthentication yes

2、将密码登录关闭,即不用密码登录
把原来的yes 改为no
PasswordAuthentication no

随后 保存即可(exc–>:wq)
在这里插入图片描述

1.5重启ssh

service sshd restart

然后就可以使用密钥登录了

在本机上,格式类似如下:

sh -i C:\id_hello root@2a01:4f9as46:0001 -p 22

2、安装python3.10

2.1删除原来的python3.6

使用rpm卸载python3

rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps

删除所有残余文件

whereis python3 |xargs rm -frv

查看现在安装的python,验证是否删除干净

whereis python

在这里插入图片描述

2.2安装python3.12

2.2.1python3镜像地址
https://registry.npmmirror.com/binary.html?path=python/
2.2.2下载自己想要的版本
wget https://registry.npmmirror.com/-/binary/python/3.12.0/Python-3.12.0.tgz
2.2.3 解压
tar -zxvf Python-3.12.0.tgz

进入目录内

cd Python-3.12.0

在这里插入图片描述

2.2.4编译
./configure prefix=/usr/local/python3
#### error1:可能会出现的错误:
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
需要:

yum install gcc
即可
2.2.5安装
make && make install
#如果出现 returned non-zero exit status 1.
#make: *** [install] Error 1
#可能是依赖不够,

sudo yum install openssl-devel bzip2-devel libffi-devel
2.2.6建立新的连接
ln -s /usr/local/python3/bin/python3.12 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3

添加环境变量

###或者
添加环境变量
vim /etc/profile

将下面的内容添加到最下面

export PATH=$PATH:/usr/local/python3/bin

保存,重启

source /etc/profile
2.2.7 设置镜像源
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

3、

  • 11
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值