Ubuntu 20.04.1 安裝軟體和系統配置指令碼

Areas發表於2020-08-30
#!/bin/bash
# https://launchpad.net/ubuntu
# https://www.easyicon.net
# https://download-chromium.appspot.com/

# sudo gedit /etc/profile

BEGINTIME=$(date "+%Y-%m-%d %H:%M:%S")
echo $BEGINTIME '>>  開始相關安裝、配置與檢查...'
# start root account:
# sudo passwd root

sudo chmod +w /etc/sudoers
sudo echo "karl    ALL=(ALL:ALL) ALL" >> /etc/sudoers
sudo chmod -w /etc/sudoers
sudo cat  /etc/sudoers



## 0.將當前使用者 karl 新增到 root 組中,使用root 賬戶進行操作
# sudo usermod -g root karl
# cat /etc/passwd
# karl:x:0:0:karl,,,:/home/karl:/bin/bash



## 1. set to update /etc/apt/sources.list
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  1.0.0.0  . set to update /etc/apt/sources.list'
# 1.1 backup sources.list
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  1.1.0.0  . backup /etc/apt/sources.list'
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old.$(date '+%Y%m%d%H%M%S')

# 1.2 create new sources.list , with 777 privileges
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  1.2.0.0  . create new sources.list , with 777 privileges'
sudo touch /etc/apt/sources.list
sudo chmod 777 /etc/apt/sources.list

# 1.3 set the aliyun sources 
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  1.3.0.0  . set the aliyun sources '
sudo cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF


## 2. update apt-get
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  2.0.0.0  . sudo apt-get update'
sudo apt-get update
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  2.0.0.0  . sudo apt-get upgrade'
sudo apt-get upgrade -y


## 3. install nautilus-admin  
# 該副檔名僅新增管理員許可權以開啟資料夾或編輯檔案,
# 沒有“以管理員身份執行”選項以超級使用者許可權執行程式
#echo $(date '+%Y-%m-%d %H:%M:%S') '>>  3.0.0.0  . install nautilus-admin'
sudo apt install nautilus-admin & nautilus -q

#echo $(date '+%Y-%m-%d %H:%M:%S') '>>  3.1.0.0  . add new document to mouse right'
sudo touch ~/Templates/'new document'



## 3. install snap
## echo $(date '+%Y-%m-%d %H:%M:%S') '>>  3.0.0.0  . install snap'
# sudo apt-get install snap
# sudo snap install snap-store
# sudo snap install snap-store-proxy
# sudo snap install snap-store-proxy-client


## 4. install chrome browser 
## echo $(date '+%Y-%m-%d %H:%M:%S') '>>  4.0.0.0  . install chromium browser'
## echo $(date '+%Y-%m-%d %H:%M:%S') '>>  4.1.0.0  . get goole chrome deb file'
# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O google-chrome-stable_current_amd64.deb
## echo $(date '+%Y-%m-%d %H:%M:%S') '>>  4.2.0.0  . install google chrome deb file'
# sudo apt install ./google-chrome-stable_current_amd64.deb
## echo $(date '+%Y-%m-%d %H:%M:%S') '>>  4.3.0.0  . remove google chrome deb file'
# sudo rm -f ./google-chrome-stable_current_amd64.deb




## 5   install chinese method
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  5.0.0.0  . install chinese method'

# 5.1 install input method fcitx, 
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  5.1.0.0  . install input method fcitx'

# sudo apt install fcitx-bin
# sudo apt-get install fcitx-table
# 5.2 and set the default input method to fcitx
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  5.2.0.0  . im-config -n fcitx'
# im-config -n fcitx



## 6 install Deepin Software
echo $(date '+%Y-%m-%d %H:%M:%S') '>>  6.2.0.0  . install deepin-screenshot'
# sudo apt install -y deepin-screenshot
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  6.3.0.0  . install deepin-terminal'
# sudo apt install deepin-terminal
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  6.3.1.0  . set default terminal to deepin-terminal'
# gsettings set org.gnome.desktop.default-applications.terminal exec deepin-terminal
# gsettings set org.gnome.desktop.default-applications.terminal exec gnome-terminal



## 7 install microsoft software

# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  8.1.0.0  . install dotnet-sdk-3.1'
# wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# sudo dpkg -i packages-microsoft-prod.deb

# sudo apt-get update; \
#   sudo apt-get install -y apt-transport-https && \
#   sudo apt-get update && \
#   sudo apt-get install -y dotnet-sdk-3.1
  
## 8 install Java JDK

sudo apt-get install -y openjdk-14-jre-headless

## 9 install git
sudo apt-get install -y git

## 10 install nodejs
# config hosts :203.74.140.139 deb.nodesource.com
# sudo apt install -y curl
# curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# sudo apt-get install -y nodejs 



## 11 install JetBrans Software
#echo $(date '+%Y-%m-%d %H:%M:%S') '>>  7.0.0.0  . install jetbrans rider'
#sudo snap install rider --classic

#echo $(date '+%Y-%m-%d %H:%M:%S') '>>  7.0.0.0  . install jetbrans datagrip'
#sudo snap install datagrip --classic

## 12 install typora
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
# wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
# add Typora's repository
# sudo add-apt-repository 'deb https://typora.io/linux ./'
# sudo apt update
# install typora
# sudo apt install typora
  

## 13 install RabbitMQ
# echo $(date '+%Y-%m-%d %H:%M:%S') '>>  11.0.0.0  . install install erlang' 
# sudo apt-get install erlang-nox
# sudo apt-get install rabbitmq-server
# sudo rabbitmqctl add_user  admin  admin
# sudo rabbitmqctl set_user_tags admin administrator
# sudo rabbitmqctl  set_permissions -p / admin '.*' '.*' '.*'
# sudo  rabbitmq-plugins enable rabbitmq_management
# http://localhost:15672/

## 14 install Radis 
# sudo apt install redis-server
# sudo systemctl enable redis-server.service


## 15 install TeamViewer
# wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
# sudo dpkg -i teamviewer_amd64.deb

## 16 install 7zip
sudo apt-get install -y p7zip-full

## 17 install synaptic software managerment
# sudo apt-get install synaptic

## 18 install gufw firewall
sudo apt-get install -y gufw

## 19 install onedrive
#1. ##################################################
# sudo apt update
# sudo apt install -y onedrive
###################################################

#2. ##################################################
# sudo apt install -y make 
# sudo apt install libcurl4-openssl-dev
# sudo apt install libsqlite3-dev

# sudo snap install --classic dmd && sudo snap install --classic dub


# cd ~
# git clone https://github.com/skilion/onedrive.git
# cd onedrive
# make
# sudo make install


## If you want to sync your files automatically, enable and start the systemd service:
# sudo systemctl --user enable onedrive
# sudo systemctl --user start onedrive
## To see the logs run:
# journalctl --user-unit onedrive -f

## uninstall onedrive
# sudo make uninstall
## delete the application state
# rm -rf .config/onedrive

###################################################


#3. ##################################################
# git clone https://github.com/xybu92/onedrive-d.git
# cd onedrive-d
# ./install.sh -y
# onedrive-pref
# y
# y
# n
# n
# onedrive-d start
###################################################



#4. ###############################################
# sudo apt install build-essential -y
# sudo apt install libcurl4-openssl-dev -y
# sudo apt install libsqlite3-dev -y
# sudo apt install git make -y
# sudo curl -fsS https://dlang.org/install.sh | bash -s dmd

# git clone https://github.com/abraunegg/onedrive.git

# cd ~/Work/Git/onedrive
# ./configure
# make clean
# make
# ls
# ./onedrive
# ./onedrive --synchronize
###################################################

## 20 install electron 
## login as root account

# export ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/
# export ELECTRON_CUSTOM_DIR=/9.2.0

## edit ~/.bashrc with  current account
# sudo vim ~/.bashrc
# export PATH=$PATH:~/.npm-global/bin
## active ~/.bashrc
# source ~/.bashrc

# npm install -g cnpm --registry=https://registry.npm.taobao.org

# cnpm install -g electron

## 21 install wine

# sudo dpkg --add-architecture i386
# wget https://dl.winehq.org/wine-builds/winehq.key
# sudo apt-key add winehq.key
# sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/

# sudo apt-get install --install-recommends winehq-stable
# sudo apt --fix-broken install
##

## 22 install Microsoft font


## 23 install WPS-2019-SNAP
# sudo snap install wps-2019-snap

## 24 install redis-desktop-manager
# sudo snap install redis-desktop-manager

## 25 install openssh-server
sudo apt-get install -y openssh-server

## 26 install notepad-plus-plus
sudo snap install notepad-plus-plus


## 27 install lldb : anlysis core dump file with .Net Core 3.0

# plugin load /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.7/libsosplugin.so
# plugin load /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.7/libmscordaccore.so
# sudo apt-cache madison lldb
# sudo apt-get install lldb=1:10.0-50~exp1
# sudo apt-cache madison lldb

ENDTIME=$(date "+%Y-%m-%d %H:%M:%S")
echo $ENDTIME ">>  結束相關安裝、配置與檢查..."
start_seconds=$(date --date="$BEGINTIME" +%s);
end_seconds=$(date --date="$ENDTIME" +%s);
echo "本次執行時間: "$((end_seconds-start_seconds))"s"
#

 

相關文章