玩命加载中 . . .

Ubuntu个人使用填坑


§Ubuntu个人使用填坑

§1. 换源

https://blog.csdn.net/u012308586/article/details/102953882

§1.1备份原始源文件 sources.list

桌面打开终端,执行命令:

sudo cp /etc/apt/sources.list  /etc/apt/sources.list.bak
§1.2修改源文件sources.list

(1)终端执行命令:

sudo  chmod  777  /etc/apt/sources.list

更改文件权限使其可编辑;

(2)执行命令:

sudo gedit /etc/apt/sources.list

打开文件进行编辑;

(3)删除原来的文件内容,复制下面的内容到其中并保存(常用的是阿里源和清华源,推荐阿里源,内容可以去博客复制);

阿里源:

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
§1.3.更新源

桌面终端执行命令:sudo apt update更新软件列表,换源完成。
yml

sudo apt update

§2.ubuntu界面美化

https://www.cnblogs.com/feipeng8848/p/12808128.html

§3.配置输入法

https://blog.csdn.net/a805607966/article/details/105874756

§4.办公环境搭建

https://blog.csdn.net/m0_38052500/article/details/107130623?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.edu_weight

https://blog.csdn.net/m0_37864814/article/details/82112029

§5.Anaconda使用

§5.1 Ubuntu关闭anaconda自动进入base虚拟环境
§在Ubuntu上安装完anaconda后,发现每次打开终端后都会自动进入到base的虚拟环境中去,虽然在这些环境下使用问题不大,但一些软件的安装在虚拟环境下有影响。每次使用conda deactivate退出也很麻烦。如何关闭自动打开的虚拟环境呢,可以采用如下命令:
conda config --set auto_activate_base false
§在最新的anaconda安装后将其加入到bashrc中后,会默认自动激活基础环境,上面的命令就是将其自动激活的true更改为false,即可关闭虚拟环境,以后需要使用直接用命令行即可。
conda activate spacename//环境的名称
§5.2 在ubuntu上卸载anaconda的步骤 :
§(一)删除整个anaconda目录:
由于Anaconda的安装文件都包含在一个目录中,所以直接将该目录删除即可。到包含整个anaconda目录的文件夹下,删除整个Anaconda目录:


rm -rf anaconda文件夹名
§(二)建议清理下.bashrc中的Anaconda路径:

1.到根目录下,打开终端并输入:

sudo gedit ~/.bashrc

2.在.bashrc文件末尾用#号注释掉之前添加的路径(或直接删除):

 #export PATH=/home/lq/anaconda3/bin:$PATH

​ 保存并关闭文件

3.使其立即生效,在终端执行:

 source ~/.bashrc

4.关闭终端,然后再重启一个新的终端,这一步很重要,不然在原终端上还是绑定有anaconda.

§5.3 激活与退出

激活虚拟环境

conda activate

然后就看到,有一个base

退出虚拟环境

conda deactivate

image-20200929031912075

§5.4 切换版本
§安装完Anaconda python 3.8,想使用python3.7方法

cmd使用命令:

conda create -n py37 python=3.7 anaconda

安装好后,会有提示:

即想激活python3.7版本,使用命令:

conda activate py37

退出python3.7,使用命令:

conda deactivate

image-20200929033257303


§6.安装java

§手动下载安装oracle Java JDK(采用了其环境变量设置方式)
  1. §去oracle官网下载,链接点此。也可以使用wget http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz 安装包在你执行这个命令时所在的文件夹位置。
  2. §解压
tar -zxvf jdk-8u111-linux-x64.tar.gz
  1. ####### 移动到自己想放的位置:
mkdir /usr/lib/jdk    
mv jdk1.8.0_111  /usr/lib/jdk/jdk1.8
  1. §设置环境变量:

方案一:修改全局配置文件,作用于所有用户:

sudo gedit /etc/profile 
export JAVA_HOME=/usr/lib/jdk/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=.:${JAVA_HOME}/bin:$PATH

方案二:修改当前用户配置文件,只作用于当前用户:

sudo gedit ~/.bashrc 

设置与上一样

  1. §使修改的配置立刻生效:
source /etc/profile 或者 source ~/.bashrc
  1. §检查是否安装成功:
java -version

§7.配置SSH

§7.1 更新组件覆盖掉Ubuntu自带的版本
sudo apt-get install openssh-client=1:7.6p1-4ubuntu0.4
sudo apt-get install openssh-sftp-server

image-20200929052015230


§8.Hadoop安装配置

https://www.cnblogs.com/tanrong/p/10645467.html

§8.1 Hadoop启动HDFS进程的时候报错,提示权限不够

image-20201014184640344

https://yq.aliyun.com/articles/695939

§解决办法,复制导入公钥就可以了,SSH链接需要使用公钥认证:

切换到ssh目录:cd ~/.ssh/

ssh-keygen -t rsa -P ""

cat$HOME/.ssh/id_rsa.pub>>$HOME/.ssh/authorized_keys

image-20201014184809855

再次启动HDFS就可以了

./sbin/start-dfs.sh

image-20201014184843343


§9.Ubuntu断网问题

ubuntu 突然不能上网了,百度得到的解决方式是先找回网络图标(做到这一步已经可以重新联网了)

宿主机连接wifi,虚拟机无法联网

运行的命令如下:

sudo service network-manager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo service network-manager start

image-20201209180928168


文章作者: Angus Lan
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Angus Lan !
评论
  目录