Ubuntu server精简安装及Lanchain安装

一、系统安装

1.ubuntu-23.04-live-server-arm64.iso;精简安装;

2.安装net-tools工具,安装vi工具;

$ sudo apt install net-tools 
$ sudo apt install vim

2.1 给root添加密码;

$ sudo passwd root 
$ logout   //退出当前用户

2.2 允许root SSH登录;修改PermitRootLogin为yes,并且把最大连接数的三行注释放开;

$ vim /etc/ssh/sshd_config
PermitRootLogin yes
StrictModes yes
MaxAuthTries 6
MaxSessions 10

2.3修改pip国内镜像;

[root@localhost ~]# cd ~
[root@localhost ~]# mkdir .pip
[root@localhost ~]# cd .pip
[root@localhost .pip]# vi pip.conf

添加内容如下:
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn 

3、查看IP地址,方便使用SecureCRT工具管理;

$ ifconfig

4、SecureCRT登录;

环境安装

5.1安装python3.8

$ sudo apt update
$ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
$ wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz    //可下载后上传服务器;
$ tar -xf Python-3.8.0.tgz   //解压缩
$ cd Python-3.8.0          //切换到Python源目录
$ ./configure --enable-optimizations   //执行configure脚本
$ make      //启动Python 3.8构建过程
$ sudo make altinstall   //安装Python二进制文件
$ python3.8 --version    //运行命令进行验证

5.2Anaconda安装

  1. 离线下载(注意根据服务器cpu的类型选择下载:https://repo.anaconda.com/archive/
  2. 上传到服务器;
  3. 在Anaconda文件夹下打开终端,输入下列代码启动安装程序:
    $ bash Anaconda3-XXXX.sh  //XXX为实际的文件名;
    
  4.  登峰登峰yes,完成安装后“reboot”重启;
  5. conda list 检测是否安装成功;

5.3Python虚拟环境安装

$ conda create -n py3.10 python=3.10  # 创建环境    (conda remove -n py3.10 --all #删除环境)
$ conda env list   //进入我们刚刚安装的python虚拟环境
$ python  //查看环境版本
# 更新py库
$ pip3 install --upgrade pip

#安装git
sudo apt update 
sudo apt install git
# 拉取仓库
$ git clone https://github.com/chatchat-space/Langchain-Chatchat.git

# 进入目录
$ cd Langchain-Chatchat

# 安装全部依赖
$ pip install -r requirements.txt

# 默认依赖包括基本运行环境(FAISS向量库)。如果要使用 milvus/pg_vector 等向量库,请将 requirements.txt 中相应依赖取消注释再安装。

5.5下载模型

$ git clone https://huggingface.co/THUDM/chatglm2-6b
$ git clone https://huggingface.co/moka-ai/m3e-base

 

 

Ubuntu https://mirror.sjtu.edu.cn/ubuntu-cdimage/releases/
CentOS http://isoredirect.centos.org/centos/7/isos/
anaconda https://repo.anaconda.com/archive/