欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Linux 简单配置

程序员文章站 2022-03-19 16:23:00
Manjaro系统安装完后的配置更换源sudo pacman-mirrors -i -c China -m rank这个会显示最快的几个源,选最快的那个就行,我选的是aliyun的源。修改/etc/pacman.confsudo pacman -S vim # vimsudo vim /etc/pacman.conf在最后添加[archlinuxcn]SigLevel = Optional TrustedOnlyServer = https://mirrors.aliyun.com/...

Manjaro系统安装完后的配置

更换源

sudo pacman-mirrors -i -c China -m rank

这个会显示最快的几个源,选最快的那个就行,我选的是aliyun的源。

修改/etc/pacman.conf

sudo pacman -S vim # vim
sudo vim /etc/pacman.conf

在最后添加

[archlinuxcn]
SigLevel = Optional TrustedOnly
Server = https://mirrors.aliyun.com/archlinuxcn/$arch

然后

# 同步软件包数据库,进行全面系统更新
sudo pacman -Syu
# key
sudo pacman -S archlinuxcn-keyring

终端ZSH美化

sudo pacman -S zsh

安装oh-my-zsh

cd ~
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh

主题

oh-my-zsh提供上百套主题,大佬也可以自定义(反正我是不会- - !),引用一位大侠的文章:
oh-my-zsh主题预览
找到自己喜欢的主题然后修改配置文件:

vim ~/.zshrc
#找到这行,把example改成你喜欢的主题名称就好
ZSH_THEME="example"
#保存退出,刷新一下
source ~/.zshrc

插件

两个常用的插件
语法高亮 zsh-syntax-highlighting 和命令补全插件 zsh-autosuggestions :

cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions

修改配置文件

#找到plugins,语法高亮插件放在最后,大佬说的,咱也不敢说,咱也不敢问
vim ~/.zshrc
plugins=(
	git
	zsh-autosuggestions
	zsh-syntax-highlighting
)
#保存退出,刷新一下
source ~/.zshrc

安装常用软件

用法:  pacman {-S --sync} [选项] [软件包]
选项:
  -c, --clean          从缓存目录中删除旧软件包 (-cc 清除所有) 
  -g, --groups         查看某软件包组所属的所有软件包
                       (-gg 查看所有软件包组和所属于它们的软件包)
  -i, --info           查看软件包信息 (-ii 查看更多信息)
  -l, --list <repo>    查看在该软件库中的软件包清单
  -s, --search <正则表达式> 按照指定字符串查询远端软件库
  -u, --sysupgrade     升级所有已安装的软件包 (-uu 可启用降级)
  -y, --refresh        从服务器下载新的软件包数据库
  					   (-yy 强制更新软件包数据库)

卸载软件及其依赖

sudo pacman -Rs mysql # 卸载 mysql 及其依赖
sudo pacman -R mysql # 仅卸载软件

清除系统中无用的包

sudo pacman -R $(pacman -Qdtq)

清除已下载的安装包

sudo pacman -Scc

安装前更新软件库是个好习惯

sudo pacman -Sy

谷歌输入法

sudo pacman -S fcitx-im # 询问直接enter
sudo pacman -S fcitx-configtool
sudo pacman -S fcitx-googlepinyin #

配置文件

sudo vim ~/.pam_environment

写入

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
reboot

按照自己习惯配置输入法快捷键。

yay (AUR助手)

sudo pacman -S yay

百度网盘

sudo pacman -S baidunetdisk-bin 

Latte-Dock

(类似mac的)

sudo pacman -S latte-dock

谷歌浏览器

sudo pacman -S google-chrome

设置为默认浏览器

  1. 系统设置默认程序 浏览器为Chrome。
  2. 新建test.html,打开方式将Chrome放在首位。

网易云音乐

sudo pacman -S netease-cloud-music

Typora

sudo pacman -S typora

开发环境搭建

JDK

~ sudo archlinux-java --help
archlinux-java <COMMAND>

COMMAND:
        status          List installed Java environments and enabled one
        get             Return the short name of the Java environment set as default
        set <JAVA_ENV>  Force <JAVA_ENV> as default
        unset           Unset current default Java environment
        fix             Fix an invalid/broken default Java environment configuration
~ 

安装

sudo pacman -S jdk8-openjdk #这里要选择你需要的版本,我这选的openjdk8

查看JDK信息

[yuruoli☮yuruoli-PC]-(~)> sudo archlinux-java status 
Available Java environments:
  java-8-openjdk (default)[yuruoli☮yuruoli-PC]-(~)> java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

切换JDK版本

sudo pacman -S jdk # 安装jdk15

sudo archlinux-java set java-15-jdk 

sudo archlinux-java status              

卸载JDK(注意删除掉所有组件)

sudo pacman -R jdk                
sudo pacman -R jre     

Maven(需要JDK)

没装JDK的话会提示你安装JDK

sudo pacman -S maven
mvn -version
sudo vim /etc/profile

# 添加如下内容
export M2_HOME=/opt/maven
export PATH=$M2_HOME/bin:$PATH

Source /etc/profile
sudo mkdir ~/.m2
sudo cp /opt/maven/conf/settings.xml ~/.m2/setting.xml
sudo vim ~/.m2/setting.xml

更该本地仓库地址(不一定需要)以及配置镜像源

本地仓库默认为当前用户 ~/.m2/repository

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

mysql

yuruoli@yuruoli-PC ~ % sudo pacman -S mysql 	# 注意观察,有提示          
[sudo] yuruoli 的密码:

正在解析依赖关系...
正在查找软件包冲突...

软件包 (4) jemalloc-1:5.2.1-3  libmysqlclient-8.0.21-1  mysql-clients-8.0.21-1  mysql-8.0.21-1

全部安装大小:  216.44 MiB

:: 进行安装吗? [Y/n] y
(4/4) 正在检查密钥环里的密钥                                 [################################] 100%
(4/4) 正在检查软件包完整性                                   [################################] 100%
(4/4) 正在加载软件包文件                                     [################################] 100%
(4/4) 正在检查文件冲突                                       [################################] 100%
(4/4) 正在检查可用存储空间                                   [################################] 100%
:: 正在处理软件包的变化...
(1/4) 正在安装 libmysqlclient                                [################################] 100%
(2/4) 正在安装 jemalloc                                      [################################] 100%
jemalloc 的可选依赖
    perl: for jeprof [已安装]
(3/4) 正在安装 mysql-clients                                 [################################] 100%
(4/4) 正在安装 mysql                                         [################################] 100%
:: You need to initialize the MySQL data directory prior to starting
   the service. This can be done with mysqld --initialize command, e.g.:
   mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
:: Additionally you should secure your MySQL installation using
   mysql_secure_installation command after starting the mysqld service
mysql 的可选依赖
    perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and mysql_setpermission
:: 正在运行事务后钩子函数...
(1/3) Reloading system manager configuration...
(2/3) Creating temporary files...
(3/3) Arming ConditionNeedsUpdate...
yuruoli@yuruoli-PC ~ % sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql

2020-11-29T08:46:07.022425Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-11-29T08:46:07.022476Z 0 [System] [MY-013169] [Server] /usr/bin/mysqld (mysqld 8.0.21) initializing of server in progress as process 7499
2020-11-29T08:46:07.028503Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-11-29T08:46:16.432894Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-11-29T08:46:35.324028Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *G__i5AFLbu9
# 这里输出了mysql root 的默认密码
# 
sudo systemctl status mysqld # 查看mysql服务状态
sudo systemctl start mysqld   # 开启mysql服务
 yuruoli@yuruoli-PC ~ % sudo mysql_secure_installation # 常规化安全设置

Securing the MySQL server deployment.

Enter password for user root:     # 输入默认密码

The existing password for the user account root has expired. Please set a new password.

New password: # 新密码

Re-enter new password: # 再次输入 

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: n     # 这里就是检测你密码强度,我选择关闭。选开启的话,会让你选密码强度级别,设置密码得达到那个级别才行。
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y # y

New password: # 刚才输入的新密码

Re-enter new password: # 再次输入
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y # 作为默认安装的一部分,mysql安装匿名用户,无需真实用户即可登录数据库。所以我们应该删除这个用户
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y # 只有本地主机(其中安装了mysql服务器)可以使用root帐户进行连接。所以我们应该远程禁止root登录。
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y # 删除测试数据库
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y # 更改立即生效
Success.

All done! 

测试是否安装完毕

yuruoli@yuruoli-PC ~ % mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.21 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> exit;
Bye

mysql管理工具

sudo pacman -S mysql-workbench

卸载mysql

(待完善,应该还有其他地方要删,不过我这个能删了,重装也成功)

sudo systemctl stop mysqld 

sudo rm -rf /var/lib/mysql

sudo pacman -Rs mysql

IDEA

sudo pacman -S intellij-idea-ultimate-edition

VS Code

sudo pacman -S visual-studio-code-bin 

pycharm

sudo pacman -S pycharm-professional 

git gitkraken

sudo pacman -S git
sudo pacman -S gitkraken

本文地址:https://blog.csdn.net/qq_45188813/article/details/110290852

相关标签: linux manjaro