Linux开发环境:Ubuntu配置

Ubuntu 环境配置

1. 网络配置

  • 脚本代码(setip.sh):
#!sh

# 配置ip和网关
ifconfig enp0s31f6 10.170.241.142 netmask 255.255.255.0

# 配置路由
route add default gw 10.170.241.1

# 配置DNS或云服务器
echo 'nameserver 10.170.133.11' >> /etc/resolv.conf

/etc/init.d/networking restart

其中,enp0s31f6是命令ifconfig获取的设备号(第一个字段即是);10.170.241.142改为自己的IP地址;255.255.255.0:网关;10.170.241.1:路由;10.170.133.11:DNS。

  • 运行脚本即可:sudo sh setip.sh

Ubuntu环境问题解决

1. 内网配置代理

  • 出现的问题
  1. Proxy tunneling failed: Proxy Authorization RequiredUnable to establish SSL connection.
  2. 407 Proxy Authorization Required等
  • 问题解决

设置用户代理和超级用户代理
用户代理修改:~/.bashrc
root用户代理修改:/etc/profile
例如: pip install 要用到*~/.bashrc代理配置。而sudo pip install要用到/etc/profile*的代理配置

  • 内网代理格式
# ~/.bashrc代理设置
HTTP_PROXY=http://username:password@proxyaddress:port
export HTTP_PROXY
HTTPS_PROXY=http://username:password@proxyaddress:port
export HTTPS_PROXY

/etc/profile同样如此。

2. apt-get install: Failed to fetch ×××,407 Proxy Authorization Required

  • 问题解决

如果你公司的网络架构是通过一个代理服务器上网,那么Ubuntu在使用apt-get更新的时候会出现问题。即使你配置了系统范围内的代理(System wide proxy server)。通常在执行apt-get update等命令的时候,会出现下面这样的错误:
407 Proxy Authentication Required
很简单,我们只要更改apt-get的配置文件就可以了,修改**/etc/apt/apt.conf**的内容:

$ cat /etc/apt/apt.conf  
Acquire::http::proxy "http://username:passowrd@proxy:80/";
Acquire::ftp::proxy "ftp://username:password@proxy:80/";
Acquire::https::proxy "https://username:password@proxy:80/";

username,password,proxy以及端口都要按照实际的修改。

软件安装

1. Ubuntu XGBoost安装

参考:

git方式安装(官网,亲测可以)

  1. 打开终端,用git指令克隆GitHub上的xgboost代码仓库,注意recursive参数的使用:
    git clone --recursive https://github.com/dmlc/xgboost.git

  2. 建立共享库(此过程需要一点时间,请耐心等待)
    cd xgboost
    make -j4

  3. Python依赖项的安装
    sudo apt-get install python-setuptools

  4. Python package的安装(利用用户目录下的Anaconda3.5.2中的python安装)
    cd python-package
    python setup.py install --user

  5. Python中导入测试:

>>> import xgboost
>>>
>>> exit()

2. Ubuntu Firefox同步问题:安装Firefox中国版

切换本地服务和全球服务。只有在同一种服务下,才能实现同步。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值