安裝ubuntu後必須做的事

本文將整理安裝ubuntu 後必須做的幾件事,以幫助ubuntu愛好這更好更快的使用ubuntu,本文適用於ubuntu19.10 eoan或其他版本

  • 1.前期準備
  • 1.1 換阿里雲源
  • 1.2 安裝apt-fast
  • 1.3 安裝preload
  • 1.4 修改swappiness參數
  • 1.5 安裝驅動
  • 1.6 交互優化
  • 1.7 SSD優化
  • 1.8 掛載內存分區
  • 2.安裝必備應用
  • 2.1 安裝curl wget axel
  • 2.2 安裝openssh-server
  • 2.3 安裝網易雲音樂
  • 2.4 安裝QQ
  • 3.安裝開發環境
  • 3.1 安裝docker
  • 3.2 安裝docker-compose
  • 3.3 安裝nvm
  • 3.4 安裝go
  • 3.5 安裝atom
  • 3.7 安裝pycharm
  • 3.8 安裝phpstorm
  • 3.9 安裝postman
  • 4.0 安裝terminator
  • 4.1 安裝mysqlworkbentch
  • 4.2 開啓遠程桌面

1.前期準備

1.1 換阿里雲源

1.備份源(修改配置前必須備份原先配置是一個好習慣)

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2.編輯

sudo vi /etc/apt/sources.list

3.輸入(注意不同版本對應)

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

4.更新

apt-get update
1.2 安裝apt-fast

apt-fast多線程下載軟件包,大幅提高軟件安裝速度

apt install apt-fast
1.3 安裝preload

preload可以大幅提高ubuntu應用啓動速度

apt-fast install preload
1.4修改swappiness參數

swappiness的值越大,表示越積極使用swap分區,越小表示越積極使用物理內存。默認值爲60

sudo vi /etc/sysctl.conf
vm.swappiness=5
sudo sysctl -p
1.5 安裝驅動

Ubuntu 默認沒有安裝顯卡驅動,所以需要安裝對應的顯卡驅動
打開軟件和更新=>附加驅動安裝驅動
在這裏插入圖片描述

1.6交互優化

注意普通用戶下執行

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize' #點擊圖標最小化
1.7SSD優化

增加noatime,discard減少SSD寫入

vi /etc/fstab
 UUID=332ccde3-50d9-46fc-afcf-d5fef63a43f7 /               ext4  noatime,discard,errors=remount-ro 0       1
1.8掛載內存分區
vi /etc/fstab
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /cache tmpfs defaults,noatime,mode=1777 0 0

由於tmpfs斷電消失的特性,需關機時備份緩存,開機時寫入tmpfs裏,故新增一個服務

vi  /lib/systemd/system/ramcache.service

配置如下:

[Unit]
Description=Ramdisk
# 等待/cache目錄掛載
RequiresMountsFor=/cache
DefaultDependencies=no
Conflicts=reboot.target
Before=shutdown.target

[Service]
#注意文件夾權限和文件路徑,以及原有文件修改時間,否則緩存將失效
Type=oneshot
RemainAfterExit=true
ExecStopPre=mkdir -p "/home/timo/.ramcache"  
ExecStart=rsync -ra "/home/timo/.ramcache/" "/cache/"   
ExecStop=rsync -ra "/cache/" "/home/timo/.ramcache/"

[Install]
WantedBy=multi-user.target

使其生效

systemctl daemon-reload

開啓啓動

sudo systemctl enable ramcache.service

把緩存目錄放到內存分區裏,通常谷歌瀏覽器的緩存就保存在.cache裏

rm -rf .cache&&ln -s /cache .cache

參考:自建服務


2.安裝必備應用

2.1安裝curl wget axel

curl,wget 爲基礎網絡請求工具,其中axel爲多線程下載工具,axel可提高某些下載鏈接的下載速度

apt-fast install curl wget axel -y
2.2安裝 openssh-server
apt-fast intall openssh-server
service ssh start			#啓動openssh-server
service ssh status                      #查看ssh運行狀態
2.3安裝網易雲音樂

官網下載https://music.163.com/#/download並安裝即可


3.安裝開發環境

3.1 安裝docker

參考:https://www.runoob.com/docker/ubuntu-docker-install.html

3.2 安裝docker-compose

參考:https://blog.csdn.net/qq_32013641/article/details/102595184

3.3 安裝nvm

注意使用普通用戶安裝nvm

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

安裝穩定版並設置淘寶源

nvm install stable
npm config set registry https://registry.npm.taobao.org
3.4 安裝go

參考:https://blog.csdn.net/qq_32013641/article/details/88579215

3.5 安裝atom

官網下在安裝即可

3.7 安裝pycharm

參考:https://www.jetbrains.com/pycharm/download/#section=linux

3.8 安裝phpstorm

參考:https://www.jetbrains.com/pycharm/download/#section=linux

3.9安裝postman

參考:https://blog.csdn.net/kan2016/article/details/81582949

4.0安裝terminator

terminator可以在一個窗口打開多個終端,並提供更炫酷的UI效果

apt-fast install   terminator

在這裏插入圖片描述

4.1安裝mysqlworkbentch
sudo apt-fast install mysql-workbench

4.2 開啓遠程桌面

安裝vnc所需依賴

sudo apt-fast install ubuntu-gnome-desktop
sudo apt-fast install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
sudo systemctl enable gdm
sudo systemctl start gdm

安裝vncserver

sudo apt install tigervnc-standalone-server tigervnc-common tigervnc-xorg-extension tigervnc-viewer

編輯vnc配置

vi ~/.vnc/xstartup

輸入如下配置

 #!/bin/sh
# Start Gnome 3 Desktop 
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &

啓動vncserver

vncserver -depth 32 -geometry 1366x768

安裝noVNC

sudo snap install novnc

啓動noVNC

novnc --listen 6081 --vnc localhost:5902

開機啓動noVNC

sudo snap set novnc services.n6081.listen=6081 services.n6081.vnc=localhost:5902

參考:正確的姿勢-https://www.cyberciti.biz/faq/install-and-configure-tigervnc-server-on-ubuntu-18-04/
參考: https://cloud.tencent.com/developer/article/1350304
參考:https://www.jianshu.com/p/143fc4b63550

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章