2258X V5基本信息
- 配置信息:
- 型号2288X V5
- BIOS版本:8.02/ Release Date: 04/14/2021
- 处理器型号:Intel® Xeon® Gold 6238R CPU @2.20GHZ
- iBMC版本:6.27
- RAID控制卡型号:Adaptec SmartRAID 3152-8i
准备
- 申请固定IP
- 将服务器管理口、远程登录口连接交换机
- 下载镜像:
检查一下兼容性:https://support-it.huawei.com/ftca/zh/product/rack-server
但是感觉跟版本关系不。
环境配置
配置IP
服务器BIOS中配置固定IP,WEB远程登陆IP,进入服务器管理页面
配置RAID
在配置页面登录远程控制器,新建RAID。方法:进入BIOS-设备管理器,并设置传统启动方式的启动盘
安装
UEFI方式安装
在iBMC中设置BIOS启动方式为UEFI,配置在远程控制窗口(KVM)中,加载下载的镜像,启动顺序设置为光驱,重启进行安装。
Legacy方式安装
BIOS将启动方式中的UEFI关闭(或在iBMC的BIOS配置中切换为传统BIOS启动),配置启动顺序:光驱优先。在远程登录器中加载下载的光盘镜像.重启服务器,进入安装。
Smart Provisioning方式安装
启动时使用Smart Provisioning方式安装
系统配置
离线安装net-tools(解决ifconfig、netstat等命令没安装的问题)
参考:ubuntu安装net-tools | MambaInVeins Blog (gitee.io)
先下载,然后再iBMC的kvm中用文件的方式加载该文件
执行mount /dev/sr0 /mnt
命令,将该文件加载到该文件夹
然后:cd /mnt
,后安装sudo dpkg -i xxx.deb
配置网卡IP
需要新申请一个固定IP。注:服务器的管理口无法作为业务口使用,Ubuntu系统中看不到管理口对应的网卡。具体连线类似下图(单机场景网线连接规划 - eSight 20.1 硬件安装指南 (2288X V5) 08 - 华为 (huawei.com))
Ubuntu系统下配置方法参考:ubuntu修改配置IP地址和DNS的方法总结(4种)_黄志千的博客_ubuntu 配置ip
- 机器中网卡的IP、DNS配置如下:
addresses: [10.107.10.18/24]
gateway4: 10.107.10.1
nameservers:
addresses: [10.129.0.148,10.98.48.151,10.72.55.103,114.114.114.114,8.8.8.8,8.8.4.4]
- 注:如果出现类似于"[2.850219] systemd-fstab-generator[117]: Failed to create unit file /run/systemd/generator/-.mount: File exists"的错误,可以修改该文件(sudo),注释掉重复。
配置Ubuntu镜像
# 备份配置文件
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
# 修改sources.list文件,将http://archive.ubuntu.com和http://security.ubuntu.com替换成http://镜像.com,可以参考如下命令:
sudo sed -i "s@http://.*archive.ubuntu.com@http://镜像.com@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@http://镜像.com@g" /etc/apt/sources.list
之后运行sudo apt-get update
进行升级
安装 图形界面
sudo apt-get update
apt-get install ubuntu-desktop #安装桌面软件
reboot #重启
上述步骤执行后,即安装完gnome,下面通过安装xrdp使能远程桌面登录(参考:如何在Ubuntu 20.04上安装Xrdp服务器 | myfreax)
sudo apt install xrdp
修改对应的桌面系统
sudo vim /etc/xrdp/startwm.sh
#注释最后两行,在末尾加
gnome-session
查看服务是否启动
sudo systemctl status xrdp
将xrdp用户添加到ssl-cert中
sudo adduser xrdp ssl-cert
重启服务,使之生效
sudo systemctl restart xrdp
在window系统下,运行mstsc输入IP进行远程登录
互传文件
- window→Ubuntu
scp filepath/filename username@IP:~/target_dir
期间会有鉴权
通过XFTP方式
配置:
# 编辑ssh文件
sudo vim /etc/ssh/sshd_config
找到如下Authentication配置,编辑如下:
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
重启ssh
sudo systemctl restart ssh
或
sudo /etc/init.d/ssh
然后用Xftp新建连接即可
软件配置
Python
Anaconda
- 下载
- 安装
bash xxx.sh
中间可以配置安装路径
- 输入conda可以看到输出,如果提示命令不存在,运行:
source ~/.bashrc
- 配置镜像和代理
方式一:使用命令行
首先生成condarc文件(/home/username/下,隐藏文件ls -a
)
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
添加代理(如果ubuntu配置了系统网络设置的代理,此项可不配置)
conda config --set proxy_servers.http http://用户名:密码@proxy.xxx.com:8080
conda config --set proxy_servers.https http://用户名:密码@proxy.xxx.com:8080
注:特殊字符(如@)需要转义
关闭ssl验证
conda config --set ssl_verify false
方式二:直接编辑condarc文件
sudo vim ~/.condarc
编辑文件大致如下:
auto_activate_base: false
ssl_verify: true
channels:
- defaults
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true
proxy_servers:
https: http://127.0.0.1:19964
- 附常用命令
# 恢复默认镜像
conda config --remove-key channels
# 查看当前channels
conda config --show channels
# 查看当前condarc配置
conda config --show-sources
- 常见问题:
- 如果已经配置好以上步骤,在conda的时候仍然报错:HTTP 000, 考虑打开.condarc文件,把里面镜像源网址的https改为http, 再把default删掉即可!
pip配置
修改 ~/.pip/pip.conf 文件,如果没有则创建。输入以下内容
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = https://mirrors.aliyun.com
有时连接不上可能是因为ubuntu设置了代理,可以设置no_proxy来规避访问该镜像时走代理:
sudo vim ~/.bashrc
在文末输入:
export no_proxy='镜像地址'
刷新变量
source ~/.bashrc
Pycharm远程调试
参考:PyCharm远程运行调试代码 - 知乎 (zhihu.com)
关键步骤:
- Tools-Deployment-Configuration,创建一个SFTP连接,设置用户名、密码,远端地址
- 上述对话框Mappings选项卡中,Deployment path的地址中输入’/'即可,否则会在步骤1中的远端地址嵌套
- 编译器配置为远端服务器的python,可以通过下来选择的方式
Ubuntu下Pycharm安装
- 下载Pycharm
- 解压,将解压后的目录复制到目标位置
- 在xxx/pycharm**/bin下,运行
sh xxx.sh
- 打开后 激活,通过服务器激活时,可能需要在代理中规避掉服务器地址
JupyterLab
- 创建环境
conda create -n py_jupyter python=3.8
conda activate py_jupyter
- 安装
pip install jupyterlab
- 生成配置文件
jupyter lab --generate-config
- 生成密码
# bash下
ipython3
# 进入环境,输入:
from notebook.auth import passwd
# 然后
passwd()
# 输入要设置的密码,生成值:
Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$10h8aCLMJa9RannEyJPqzg$QTK5lTPb2tkxYYjaCgGs7cz+AcLUkdnNHdhsicbfxDQ'
- 配置Jupyter Lab配置文件
vim /home/tao/.jupyter/jupyter_lab_config.py # 目录取决于生成时输出的位置
# 修改以下值
c.ServerApp.allow_root = True
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.open_browser = False
# 登录密码
c.ServerApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$10h8aCLMJa9RannEyJPqzg$QTK5lTPb2tkxYYjaCgGs7cz+AcLUkdnNHdhsicbfxDQ'
# 启动目录
c.ServerApp.root_dir = '/home/tao/docs/jupyter'
- 启动进程
nohup jupyter lab & # nohup表示ssh中断后仍然运行,&表示后台运行
- 此时可以在源端通过IP:8888进行访问
JDK配置
- 下载JDK
- 创建安装目录
sudo mkdir /usr/lib/jvm
- 解压到该目录
sudo tar -zxvf jdk-8u212-linux-x64.tar.gz -C /usr/lib/jvm
- 修改环境变量
sudo vi ~/.bashrc
在文件末尾追加
# set huawei jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_212
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
- 刷新使之立即生效
source ~/.bashrc
- 如果装了多个jdk版本,可以通过下述命令查看
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_191/bin/java 300
MySQl配置
(参考:Ubuntu18.04 安装MySQL_Weison_ubuntu 安装mysql)
首先下载
sudo apt-get install mysql-server
初始化配置
sudo mysql_secure_installation
选项设置如下
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N (我的选项)
#2
Please set the password for root here...
New password: (输入密码)
Re-enter new password: (重复输入)
#3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的选项)
#4
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项)
#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的选项)
#6
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项)
查看服务状态
systemctl status mysql.service
用户登录
sudo mysql -uroot -p
创建数据库
create DATABASE tsn2_0
更改时区
set global time_zone = '+8:00';
新建用户,配置权限
# 创建用户
CREATE USER 'tsn'@'%' IDENTIFIED by 'password';
# 授权
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';
# 刷新
FLUSH PRIVILEGES;
# 远程连接授权
ALTER USER 'tsn'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
# 刷新
FLUSH PRIVILEGES;
可以通过select user, host from user
命令查看权限,如下:
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| tsn | % |
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
此时,可以通过远yuan端telnet IP地址 端口号
命令进行远程连接数据库,如果显示下述错误
Connecting To 10.107.10.18...Could not open connection to the host, on port 3306: Connect failed
则需要排除以下原因
- 防火墙
允许MySQL经过防火墙:
sudo ufw allow 3306/tcp
- 查看监听端口是否正确
netstat -apn|grep 3306
#输出如下
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
Local Address的地址为127.0.0.1 说明该端口对本地可见,对外不可见
# 开启对外端口
vim /etc/mysql/mysql.conf.d/mysqld.cnf
# 注释掉该行
#bind-address = 127.0.0.1
# 重启MySQL
/etc/init.d/mysql restart
再次查看
netstat -apn|grep 3306
#输出如下
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN -
tcp6 0 0 :::3306 :::* LISTEN -
此时远端可以进行连接