Ubuntu18.04安装配置问题解决方法

1. 更改 sources.list 与自动更新

使用aliyun镜像来源:

deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

# 仿照清华镜像源,注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

将其更改替换全部的/etc/apt/sources.list (sudo vim 命令打开),之后进行命令更新

source /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade

2. 解决R自动更新问题

先在系统中安装R语言:

sudo apt-get install r-base-core

安装结束后,打开R会看到R版本还是2018年,同样需要在source.list中添加R更新源
可进入R官网找到自己需要的镜像地址,我的系统合适的地址选择为:

deb https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/linux/ubuntu bionic-cran35/

(此地址选择还需要看安装的ubuntu系统版本,看系统版本号可以通过来看

lsb_release -a

我的电脑内核名为 bionic,所以source.list中添加的为bionic-cran35/

之后更新source.list:

source /etc/apt/source.list
sudo apt-get update
sudo apt-get upgrade

Error处理,若遇到秘钥等更新失败,可参考R官方给出的解决方法:
https://cran.r-project.org/bin/linux/ubuntu/README.html
我是根据说明,运行以下命令:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

到此完美解决R不能自动更新问题。

3.解决安装R packages时出现Bug

在安装某些R包时,会报出‘installation of package '**' had non-zero exit statu’的错误。

#Type this Following Code:
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev
sudo apt-get update
sudo apt-get upgrade

一般情况都能解决R包无法安装问题。

4. 更新Python3.6版本到Python3.7

Ubuntu18.04系统默认自带的python3版本为3.6,在今后使用过程中会带来些许不便,升级python时,可先查看版本号:

python3 --version

升级操作如下:

4.1 安装Python3.7

sudo apt-get install python3.7

4.2 建立新的软件链接

首先删除原有链接:

sudo rm -rf /usr/bin/python3
sudo rm -rf /usr/bin/pip3

4.3 查看Python3.7安装路径:

which python3.7

4.4 创建新的软连接:

#添加python3的软链接
sudo ln -s python_PATH /usr/bin/python3
#添加 pip3 的软链接
sudo ln -s python_PATH /usr/bin/pip3

#测试是否安装成功了
python3 --version

4.5 解决更新源异常问题

升级到python3.7会导致python库的引用产生混乱,导致更新源等操作时候报错,解决方法:

# 先选择删除python-apt
apt-get remove --purge python-apt
# 安装python-apt
apt-get install -f -y python-apt
# 拷贝python3.5的apt-pkg*.so 名重名为python3.6的apt-pkg*.so
cd /usr/lib/python3/dist-packages/
cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.cpython-37m-x86_64-linux-gnu.so

5.Ubuntu18.04开启wifi热点

我们办公室无公共WiFi,可能为了减少手机使用度,为解决手机链接wifi问题,我需要在ubuntu系统上开启wifi hotspot。要开启热点,需要有以下设备:1.装有Ubuntu18.04系统,使用网线上网的台式机。2.台式机上有台式机外置网卡,以用于释放hotspot信号。降网卡插入台式机后置USB借口后进行以下设置。
终端输入以下命令,以打开网络配置界面:

nm-connection-editor
Screenshot from 2019-08-04 10-31-00.png

点击左下角加号,添加网络。
接着需要设置三个地方:


Screenshot from 2019-08-04 10-33-14.png

Wi-Fi这一栏:填上SSID名称,即是手机能搜索到的hotspot名。
选择Mode的模式为Hotspot。


Screenshot from 2019-08-04 10-33-26.png

WI-FI Security这一栏为热点密码安全性设置,将Security选择为WPA&WPA2 Personal,并在下面填写设置的热点密码。
Screenshot from 2019-08-04 10-33-31.png

最后IPv4 Setting一栏,将Method选择为共享到其他电脑Shared to other computers即可。
最后点击保存即可手机链接上网。

另外,我的电脑未出现bug情况,若出现无法使用之类的状况,有可能与外置网卡型号有关。

6.解决Ubuntu18.04上安装Rstudio-1.2.1335闪退的问题

新的Ubuntu系统可能由于不匹配最新版本的Rstudio-1.2.1335,导致Rstudio总是运行不久便闪退,无法正常应用。看了网上的帖子,发现有很多类似的情况。解决方法最多的是安装低版本Rstudio。
但我下载低版本的Rstudio-1.1.463后,又出现无法安装现象,该换成gdebi安装Rstudio-1.1.463时候

sudo gdebi rstudio-1.1.463-amd64.deb

报错信息为: Dependency is not satisfiable: libgstreamer0.10-0,看上去低版本的Rstudio安装需要一个插件。
随后,我就放弃了,开始找寻其他适用于Ubuntu上的R语言IDE,但忙了一天还是感觉不习惯非Rstudio软件。回过头来寻找安装 libgstreamer插件的方法,看能否顺利安装低版本Rstudio。最后在另个帖子上找到了解决该问题的安装方案:

  • 首先下载并安装 libgstreamer0.10-0_0.10.36-1.5_amd64.deb 插件。
  • 然后下载并安装 libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb 插件。
    在网页中找到并下载.deb安装包,使用sudo gdebi安装连个软件包,然后尝试安装R-Studio。
    我的较低版本Rstudio就安装完毕了,运行也OK。

你可能感兴趣的:(Ubuntu18.04安装配置问题解决方法)