Ubuntu 20.04.1 系统初始化完整流程

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1. 换源: 打开 “软件更新器” 找到,如果提示更新,先不更新,其次,点击设置与Livepatch按钮,点开 “Ubuntu软件” 选项卡,找到 mirrors.ustc.edu.cn 并选择确定
而后点击关闭按钮和重新载入按钮,完成换源。其次,进行软件更新,sudo apt upgrade 执行即可

2. 安装音视频解码器: sudo apt install ubuntu-restricted-extras

3. 美化界面: sudo apt install gnome-tweaks sudo , apt install gnome-shell-extension-manager 而后从启动器找到并打开 extesion-manager 点击顶部的Browse选项卡,搜索选装以下插件

a). Dash to Pannel 用于把顶部栏合并到底部栏
b). Date Menu Formatter 设置日期格式(参考格式:kk:mm:ss\nyyyy/MM/dd )
c). Net Speed 显示实时网速
d). Compiz windows effect
e). Compiz alike magic lamp effect 同 d) 项都是窗体特效插件
f). Removeable Drive Menu 移除驱动盘在底部栏的显示


安装tim,微信等软件:(帮助文档及参考链接: https://deepin-wine.i-m.dev/)

先执行如下命令:
sudo wget -O- https://deepin-wine.i-m.dev/setup.sh | sh

确认软件名称(https://deepin-wine.i-m.dev/ 表格第一列)后进行安装,如安装微信:

sudo apt install com.qq.weixin.deepin

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

4. window/ubuntu 双系统必须设置时区,否则两系统时间不同步(参考:https://www.cnblogs.com/xiaotong-sun/p/16138941.html )

sudo timedatectl set-local-rtc 1 //修改系统时区设置,由 UTC 改为 CST
sudo apt-get install ntpdate //在Ubuntu下更新本地时间用的一个cmd命令插件
sudo ntpdate time.windows.com // 更新时间,使本机时间与这个服务器同步
sudo hwclock --localtime --systohc // 将本地时间更新到硬件上,即写入blos

5. 安装chrome浏览器及插件

sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-chrome-stable

安装常用插件,如 拦截广告的 adblocks,油猴,Qr
链接: https://caiyun.139.com/m/i?105CqQuvK6e76 提取码:6S5d

6. 安装nodejs,docker-ce,mariadb-server,nginx,redis-cli, git, maven ,openjdk,并为python的pip,nodejs的npm,docker设置国内镜像代理
a). 安装docker-ce( 参考https://www.runoob.com/docker/ubuntu-docker-install.html ,迁移docker镜像存储位置:https://www.dianjilingqu.com/125283.html)

创建文件夹,用以保存docker镜像(实际使用可根据磁盘空间和个人喜好进行选择,这里傻瓜式创建了):

cd ~ && mkdir docker-images

sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

设置国内镜像: sudo gedit /etc/docker/daemon.json

复制如下内容粘贴并保存到gedit打开的窗口中:

{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"data-root":"~/docker-images"
}

而后就可以享受加速服务了

b). 安装 mariadb-server,执行如下命令 : sudo apt install mariadb-server 执行即可,若要优化配置,有如下建议和备忘:
1. 在windows下很容易很简单也不容易出错,但谁让这是ubuntu呢?它是linux呢?所以易错点有:

1). 文件/文件夹访问权限问题,数据库的配置文件的权限不能为 777 , 建议为 664和 644 否则会忽略这个配置文件,其次,修改配置文件后如果不能启动服务, 一般是文件/文件夹的权限问题,否则就是配置文件的配置项错误
2). 有几个文件是不能被删除的,即: /etc/mysql 不建议删除,这个数据库有个自动初始化脚本文件在里边,删了而又修改data目录有可能会出问题
3). sudo mysql -u root -p 是不需要密码就能进入交互界面的,而 直接mysql -u root -p却不行
4). 修改 root密码: set password=password('你的新密码'); flush privileges;
5). mariadb 至少比mysql 多出来的一个好用的特性: 线程池,它适用于并大量大的短事务处理(参考:https://www.cnhackhy.com/7764.htm ),开启方式 如下:

sudo gedit /etc/mysql/my.cnf

添加下面两行到文末

[mysqld] #thread pool
thread_handling=pool-of-threads

c). 编译安装nginx(参考:https://www.cnblogs.com/anech/p/15975439.html)
1). sudo apt updatee && sudo apt update -y
2). sudo apt-get install libxml2-dev build-essential openssl libssl-dev make curl libcurl4-gnutls-dev libjpeg-dev libpng-dev libtool-bin bison zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libgeoip-dev libgoogle-perftools-dev libperl-dev libtool libxml2-dev build-essential openssl libssl-dev make curl libcurl4-gnutls-dev libjpeg-dev libpng-dev libtool-bin bison zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libgeoip-dev libgoogle-perftools-dev libperl-dev libtool
3). 打开网页 http://nginx.org/en/download.html 选择自己喜欢的版本或最新版下载 ,完成后解压,并在cmd打开解压后的路径
命令参考:
下载:sudo wget http://nginx.org/download/nginx-1.23.2.tar.gz
解压:sudo tar -zxvf nginx-1.23.2.tar.gz
打开目录并配置编译要加入的模块:

cd nginx-1.23.2 && ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_secure_link_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-http_auth_request_module --with-pcre --with-http_mp4_module --with-http_flv_module
可选项(在--with-http_ssl_module 后面空格粘贴):

1. http2协议: --with-http_v2_module
2. nginx连接状态信息 --with-http_stub_status_module

查看更多:http://nginx.org/en/docs/configure.html

4). 8核心编译安装nginx:sudo make -j8 && sudo make install


d). 安装nodejs,建议如下安装(参考连接:https://github.com/nodesource/distributions#debinstall)

1. curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\
2. sudo apt-get install -y nodejs
3. sudo gedit ~/.npmrc

复制粘贴如下内容并保存

registry=https://registry.npmmirror.com/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
electron_mirror=https://npm.taobao.org/mirrors/electron/

e). 安装redis数据库, 建议通过如下命令进行安装
sudo apt install redis-server
修改配置文件(一般不需要)
sudo gedit /etc/redis/redis.conf

f). 安装jdk, 由于oracle jdk协议更改,生产环境和开发环境最好一致,所以建议采用openjdk,各大厂商jdk里边, 亚马逊 jdk属于bug修复及时维护最好的一个

jdk17:https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html
jdk11:https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html
jdk8:https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html

下载想要安装版本的deb包,sudo dpkg -i 包名进行安装, 如:

sudo dpkg -i java-17-amazon-corretto-jdk_17.0.5.8-1_amd64.deb

g) 安装 git,svn,maven

sudo apt install git
sudo apt install svn
sudo apt install maven

设置maven镜像


sudo gedit /etc/maven/settings.xml

复制粘贴替换文件中的如下节点,并可修改 本地仓库路径
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>central repo</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>apache snapshots</mirrorOf>
<name>阿里云阿帕奇仓库</name>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
</mirror>
</mirrors>

并可替换其中的 jdk默认版本设置的profile节点

<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
<repositories>
<repository>
<id>aliyunmaven</id>
<name>aliyunmaven</name>
<url>https://maven.aliyun.com/repository/public</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>MavenCentral</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>aliyunmavenApache</id>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
</repository>
</repositories>
</profile>

其次,可以复制粘贴 /etc/maven/settings.xml 保存一份,使诸如sts,eclipse,vscode,IDEA,等ide自动应用aliyun镜像
sudo cp /etc/maven/settings.xml ~/.m2/settings.xml


设置pip国内镜像
mkdir ~/.pip && gedit ~/.pip/pip.conf
复制粘贴如下内容并保存

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


navicat 注册激活参考连接: https://www.bilibili.com/read/cv18230089
已按照上述流程进行操作并打好的包,链接: https://caiyun.139.com/m/i?105CfTgE2vWVj 提取码:MtsD

桌面快捷方式参考链接: https://caiyun.139.com/m/i?105CqQv72llWo 提取码:FOuz
SpringToolSuit 链接:
https://spring.io/tools
https://download.springsource.com/release/STS4/4.16.1.RELEASE/dist/e4.25/spring-tool-suite-4-4.16.1.RELEASE-e4.25.0-linux.gtk.x86_64.tar.gz
https://caiyun.139.com/m/i?105Cf9YNrkOCN 提取码:35jF (已安装webee插件和虚拟服务插件)

FileZilla下载: https://filezilla-project.org/download.php?type=client
VSCode下载: https://code.visualstudio.com/
PostMan下载: https://dl.pstmn.io/download/latest/linux64
RibbitSVN客户端 https://blog.csdn.net/weixin_44723106/article/details/122493366
Git-Cola客户端 sudo dnf install git-cola
Uget https://ugetdm.com/downloads/ubuntu/
VLC sudo apt install vlc
VIM sudo apt install vim
系统标题栏太高 https://www.cnblogs.com/ctcrst/p/16229771.html
QQ 音乐 https://y.qq.com/download/download.html

posted @ 2022-10-29 14:14  漫漫人生路总会错几步  阅读(1702)  评论(0)    收藏  举报