Ubuntu常用环境配置及常用软件安装

前言

开发使用 Linux 强烈建议使用 Ubuntu 不建议使用 CentOS

下载软件的时候推荐使用 deb 和 snap 格式的文件

应用中心

https://ubuntukylin.com/applications/

基本环境

安装显卡驱动

打开系统的软件和更新 找到附加驱动找到对应的驱动更新即可。

image-20220530171049837

Edge 插件无法下载

1
sudo gedit /etc/hosts

修改为如下

1
2
3
4
131.253.33.219 edge.microsoft.com
131.253.33.219 msedgeextensions.sf.tlu.dl.delivery.mp.microsoft.com

199.232.96.133 raw.githubusercontent.com

缩放调整

1
2
3
4
5
6
7
8
9
10
11
cd /usr/share/glib-2.0/schemas

sudo gedit org.gnome.desktop.interface.gschema.xml
# 找到text-scaling-factor, 修改default的数值为1.25

sudo gedit com.ubuntu.user-interface.gschema.xml
# 找到text-scaling-factor, 修改default的数值为1.25

sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

reboot

常用软件

微信

有两个版本可用

目前两个版本都不能截图和上传图片。

Wine版

推荐使用Wine版的。

下载Wine环境包:
Wine环境包下载地址:

http://archive.ubuntukylin.com/software/pool/partner/ukylin-wine_70.6.3.25_amd64.deb

下载微信(wine)包:
微信(wine)包下载地址:

http://archive.ubuntukylin.com/software/pool/partner/ukylin-wechat_3.0.0_amd64.deb

终端输入:

1
2
3
chmod 777 *.deb
sudo apt-get install -f -y ./ukylin-wine_70.6.3.25_amd64.deb
sudo apt-get install -f -y ./ukylin-wechat_3.0.0_amd64.deb

修改DPI(修改前要推出微信)

1
WINEPREFIX=~/.ukylin-wine/wechat /usr/bin/ukylin-wine winecfg

显示=>屏幕分辨率=>设置为120

image-20221123154116063

中文乱码

下载字体

链接: https://pan.baidu.com/s/1XsYVhD-YMnvBpatwtLgLGA 提取码: psvm

解压该压缩包

1
unzip Fonts.zip

把Fonts文件夹内所有字体复制到wine的映射目录内

1
2
3
mkdir -p ~/.ukylin-wine/wechat/drive_c/windows/Fonts/
cp ~/下载/Fonts/* ~/.ukylin-wine/wechat/drive_c/windows/Fonts/
cd ~/.ukylin-wine/wechat/drive_c/windows/Fonts/

查看是否不再乱码

1
WINEPREFIX=~/.ukylin-wine/wechat /usr/bin/ukylin-wine winecfg

Typora

https://typoraio.cn/#linux

主题

http://theme.typora.io/theme/Vue/

禁止升级

1
sudo apt-mark hold typora

图片插件

图片上传插件 picGo

PicGo-Core

我这里上传方式选择 app 的始终不行就使用PicGo-Core的方式了

安装PicGo-core
PicGo的图形界面在ubuntu上对typora支持不是很好,因此使用 PicGo-core,采用命令行方式自动上传图片。

安装nodejs

ubuntu默认不带有nodejs,若已经安装请运行命令node -v检查版本是否大于8.0

若版本小于8.0请先执行以下命令卸载旧版本nodejs

1
2
3
sudo apt-get remove nodejs
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs

测试是否安装成功,执行下面命令,显示版本号就表示安装成功

1
node -v

测试npm是否可以使用

1
npm -v

若出现版本号表示可用 跳过下面这条命令;若提示命令不存在则执行下列命令

1
sudo apt install npm

再次测试。

1
2
npm config set registry https://registry.npmmirror.com
npm config list

安装PicGo-core

1
sudo npm install picgo@1.4.26 -g

修改配置文件

1
vi ~/.picgo/config.json

以下是配置 其中qiniu中改成自己的配置。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"picBed": {
"current": "qiniu",
"uploader": "qiniu",
"qiniu": {
"accessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"area": "z1",
"bucket": "psvmc",
"options": "!github",
"path": "blog/",
"secretKey": "yyyyyyyyyyyyyyyyyyyyyyyy",
"url": "http://image.psvmc.cn"
}
},
"settings": {
"privacyEnsure": true,
"showUpdateTip": true,
"autoRename": true,
"autoStart": true
}
}

配置

  • 插入图片时改为上传图片
  • 勾选图中3个附加选项
  • 上传服务设定改为custom Command
  • 命令改为/usr/bin/node /usr/local/bin/picgo upload

PicGo-App

图片上传插件 picGo

官网:

https://molunerfinn.com/PicGo/

https://github.com/Molunerfinn/picgo/releases

镜像地址

https://mirrors.sdu.edu.cn/github-release/Molunerfinn_PicGo/v2.3.1/

下载后进行安装

1
sudo snap install picgo_2.3.1_amd64.snap --dangerous

报错

error: cannot find signatures with metadata for snap

不进行签名验证

1
--dangerous

百度云

https://pan.baidu.com/download

WPS

卸载

1
sudo apt remove wps-officesud

解决在 ubuntu 22.04 上安装 wps 打不开问题

添加权限即可

1
sudo chmod 0777 -R /opt/kingsoft/wps-office

开发环境

远程连接

使用自带软件Remmina

使用rdesktop
安装

1
sudo apt install rdesktop

使用举例

1
rdesktop 110.110.110.110:3389 -g 1024x768 -a 16 -u administrator -p '123456'

共享磁盘和剪贴板

1
rdesktop -0 110.110.110.110:3389 -g 1024x768 -a 16 -u administrator -p '123456'  -r clipboard:PRIMARYCLIPBOARD -r disk:share_home=/home

注意

密码中有特殊符号要使用单引号。

常用使用参数

1
2
3
4
5
6
7
8
9
-f 全屏
-g 桌面大小
-a 16 16位色深
-u 用户名
-p 密码
-r clipboard 表示允许在远程主机和本机之间共享剪切板,可以复制粘贴
-r clipboard:PRIMARYCLIPBOARD 共享剪贴板,连接到window7
-r disk:share=/home 共享/home目录
ctrl+alt+enter 退出全屏

连接失败,提示如下:

Connecting to server using NLA…
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
TLS Session info: (TLS1.2)-(RSA)-(AES-256-GCM)

Failed to initialize NLA, do you have correct Kerberos TGT initialized ?
Failed to connect using NLA, trying with SSL
Failed to connect, CredSSP required by server (check if server has disabled old TLS versions, if yes use -V option).

解决方法是:

  1. 先通过其他方式远程连接服务器。
  2. 右键我的电脑–>属性–>远程设置–>远程
  3. 取消勾选 仅允许运行使用网络界别身份验证的远程桌面的计算机连接(建议)(N)

SSH登录脚本

1
sudo vi /usr/local/bin/login.exp

内容

1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/expect

set timeout 30
spawn ssh -p [lindex $argv 2] [lindex $argv 0]@[lindex $argv 1]
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:"
{send "[lindex $argv 3]\n"}
}
interact

把配置文件命名为login.exp 放在/usr/local/bin目录下

设置访问权限

1
sudo chmod 777 /usr/local/bin/login.exp

连接服务器

1
login.exp root 192.168.7.101 22 zhangjian

报错:

当 Linux 服务器没有安装 expect 时,执行 expect 文件时,就会报如下错误:

/usr/bin/expect: No such file or directory

解决方法比较简单,安装 expect 命令即可。

在服务器上执行如下命令

1
sudo apt-get install expect

JDK

官方下载JDK 网址

链接: https://pan.baidu.com/s/1COHU0dKhBb9x_wWxIwuibw 提取码: psvm

安装

1
sudo tar -zxvf jdk-8u341-linux-x64.tar.gz -C /usr/local

安装后的路径为/usr/local/jdk1.8.0_341

为空的话要配置java-home 否则无法配置Tomcat为服务

1
cd /etc/profile.d/

创建配置文件

1
sudo vi /etc/profile.d/jdk.sh

加入:

1
2
3
export JAVA_HOME=/usr/local/jdk1.8.0_341
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

配置立即生效

1
sudo source /etc/profile

查询java版本

1
java -version

查看java-home

1
echo $JAVA_HOME

GIT

1
sudo apt install git

配置

1
2
git config --global user.email "183518918@qq.com"
git config --global user.name "zhangjian"

客户端软件

https://www.syntevo.com/smartgit/download/

SmartGit

默认每次都会弹出弹窗

免费申请授权申请地址

https://www.syntevo.com/cn/smartgit/register-non-commercial/

image-20220531092657916

这样选择,否则是付费的。

image-20220531092440656

在软件 帮助=> 注册产品中选择授权文件即可。

NodeJS

npm 镜像

1
2
npm config set registry https://registry.npmmirror.com
npm config list

IDEA

下载

链接: https://pan.baidu.com/s/1tGZVIMn__Srlpy7dxm-J_g 提取码: psvm
解压

1
tar -zxvf ideaIU-2021.3.3.tar.gz -C /opt/

设置图标

1
gedit /usr/share/applications/idea.desktop

内容如下

1
2
3
4
5
6
7
8
9
10
11
12
[Desktop Entry]
Name=idea
Name[zh_CN]=IDEA
Name[zh_TW]=IDEA
Exec=/opt/idea-IU-213.7172.25/bin/idea.sh
Terminal=false
Type=Application
Icon=/opt/idea-IU-213.7172.25/bin/idea.png
Comment=IDEA
Comment[zh_CN]=IDEA
Comment[zh_TW]=IDEA
Categories=Application;

无法输入中文

在IDEA打开页面

点击 help => Edit Custom VM options

在末行添加:

1
-Drecreate.x11.input.method=true

博客更新

1
npm install hexo-cli -g

生成上传

1
2
hexo g
hexo d

VSCode

下载地址

https://code.visualstudio.com/Download

无法同步配置

https://www.ipaddress.com/

中访问

vscode.dev

查看可用 IP 修改 hosts

1
sudo gedit /etc/hosts

修改为如下

1
13.107.213.51 vscode.dev

卸载

卸载的三种方式

1
2
3
4
5
apt list
apt remove weixin*

snap list
snap remove weixin*

卸载libreoffice

首先卸载libreoffice表格。

1
sudo apt remove libreoffice-calc

3.接着我们卸载libreoffice绘图。

1
sudo apt remove libreoffice-draw

然后是卸载幻灯片工具。

1
sudo apt remove libreoffice-impress

接着卸载word文档工具。

1
sudo apt remove libreoffice-writer

最后我们把其它libreoffice相关的都卸载了。

1
sudo apt remove libreoffice*

清除libreoffice配置文件。

1
2
sudo apt purge libreoffice*
sudo apt autoremove

现在我们发现ubuntu桌面上的libreoffice软件图标都没有了,卸载工作完成。