linux设置小技巧

Linux下命令严格区分大小写,终端输入命令时不能乱用

1 ubuntu

1 修改 /home 目录下文件夹名为英文

终端输入如下命令,

$ export LANG=en_US
$ xdg-user-dirs-gtk-update

2 Ubuntu设置root用户

刚安装系统后无法切换到root用户,终端输入如下命令,按提示操作即可

$ sudo passwd root

3 安装Ubuntu系统卡住

系统卡住不出意外是因为显卡的原因,现在大多数笔记本电脑除了一个CPU集显以外,还有一个NVIDIA独立显卡,由于NVIDIA驱动源代码不是开源的,所以Linux使用了第三方的NVIDIA显卡驱动nouveau,这个驱动对NVIDIA显卡的支持不太完善,所以会出现界面卡住,解决如下:

开机选择系统时,光标选择Ubuntu,然后按键盘上的E,进入图二画面,找到quiet splash,在其后添加nomodeset(nomodeset后面是鼠标指针,不是下划线),再按F10保存进入系统
在这里插入图片描述

在这里插入图片描述

  • quiet – 此选项告诉内核不产生任何输出(a.k.a。非详细模式)。如果在没有此选项的情况下启动,您将看到许多内核消息,例如驱动程序/模块激活,文件系统检查和错误。当您需要查找错误时,没有quiet参数可能很有用。
  • splash – 此选项用于启动eye-candy “loading”屏幕,同时系统的所有核心部分都在后台加载。如果您禁用它并启用quiet,您将获得一个空白屏幕。
  • nomodeset – 告诉内核在系统启动并运行之前不启动视频驱动程序。

注:此项设置只对本次开机使用过程有效,永久解决方法见下述 方法4:安装nvidia驱动

4 为Ubuntu更换国内的软件下载源

更换国内源,让软件下载更快,这里选择阿里的源

  1. 打开阿里云官方镜像站,进入找到对应系统的源(我安装的是Ubuntu20.04),复制对应内容,桌面新建文件sources.aliyun.list,将复制内容保存到文件。
    在这里插入图片描述在这里插入图片描述

  2. 备份原有文件sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

  3. 替换系统默认源sudo cat /Desktop/sources.aliyun.list > /etc/apt/sources.list

  4. 执行apt update使修改生效

Ubuntu20

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

5 安装QQ

注:关于微信、迅雷、百度网盘等更多软件下载方式详见此处

注意下述命令执行的目录,要进入到自己电脑上正确的目录

1 安装qq前需要安装一个deepin-wine,终端依次执行下列命令

若提示git未安装,先执行命令sudo apt install git

root@rorschach:/home/rorschach/Downloads## git clone https://gitee.com/wszqkzqk/deepin-wine-for-ubuntu.git
root@rorschach:/home/rorschach/Downloads## cd deepin-wine-for-ubuntu/
root@rorschach:/home/rorschach/Downloads/deepin-wine-for-ubuntu## ./install.sh

2 安装qq

root@rorschach:/home/rorschach/Downloads## wget http://packages.deepin.com/deepin/pool/non-free/d/deepin.com.qq.im/deepin.com.qq.im_9.1.8deepin0_i386.deb
root@rorschach:/home/rorschach/Downloads## dpkg -i deepin.com.qq.im_9.1.8deepin0_i386.deb 

wget http://mirrors.aliyun.com/deepin/pool/non-free/d/deepin.com.qq.im/deepin.com.qq.im_8.9.19983deepin23_i386.deb
sudo dpkg -i deepin.com.qq.im_8.9.19983deepin23_i386.deb

wget:从特定url下载东西

  • 此指令下载后的文件默认保存在pwd工作目录,具体路径终端输入pwd查看
  • 指定下载目录
    wget -p 目录 网址
    wget -P /xxx/download 网址

3 打开软件列表,选择QQ,启动登录

在这里插入图片描述

6 双系统windows & Ubuntu时间不一致

无论是windows时间不对,还是ubuntu时间不对。均按如下命令设置即可

sudo apt install ntpdate
sudo ntpdate time.windows.com
sudo hwclock --localtime --systohc

7 删除无效的ppa源

1 查找出失效的PPA源:

root@rorschach:/home/rorschach/Desktop## apt-get update | grep "Failed"
E: 仓库 “http://ppa.launchpad.net/wine/wine-builds/ubuntu focal Release” 没有 Release 文件。

2 根据上述命令执行结果删除无效源

root@rorschach:/home/rorschach/Desktop## add-apt-repository -r ppa:wine/wine-builds
 !!! PLEASE NOTE THAT THIS REPOSITORY IS DEPRECATED !!!

For more information, please see:

    https://www.winehq.org/pipermail/wine-devel/2017-March/117104.html

The following commands can be used to add the new repository:

    wget https://dl.winehq.org/wine-builds/Release.key
    sudo apt-key add Release.key
    sudo apt-add-repository 'https://dl.winehq.org/wine-builds/ubuntu/'

 更多信息: https://launchpad.net/~wine/+archive/ubuntu/wine-builds
按 [ENTER] 继续或Ctrl-c 取消卸载。

root@rorschach:/home/rorschach/Desktop## apt-get update | grep "Failed"
root@rorschach:/home/rorschach/Desktop## 

再次执行命令apt-get update | grep "Failed"发现已经删除成功

8 安装/卸载字体

手动安装

1、安装。字体通常安装以下目录中:

1、 /usr/share/fonts/
2、 /usr/local/share/fonts/
3、 ~/.local/share/fonts/

$ cd /usr/local/share/fonts
$ mkdir firacode
$ cp /path/to/xxx.ttf firacode
$ sudo chmod u+x firacode
$ sudo mkfontscale		创建fonts.scale文件,用来控制字体旋转缩放
$ sudo mkfontdir		创建fonts.dir文件,用来控制字体粗斜体产生
$ sudo fc-cache -fv		建立字体缓存信息,让系统识别相应字体

2、查看

$ fc-list | grep -i firacode

/usr/local/share/fonts/firacode/FiraCode-Retina.otf: Fira Code,Fira Code Retina:style=Retina,Regular
/usr/local/share/fonts/firacode/FiraCode-Bold.otf: Fira Code:style=Bold
/usr/local/share/fonts/firacode/FiraCode-Regular.otf: Fira Code:style=Regular
/usr/local/share/fonts/firacode/FiraCode-Medium.otf: Fira Code,Fira Code Medium:style=Medium,Regular
/usr/local/share/fonts/firacode/FiraCode-Light.otf: Fira Code,Fira Code Light:style=Light,Regular

3、卸载

# 直接删除字体所在文件夹即可
sudo rm -rf /usr/local/share/fonts/firacode
sudo fc-cache -fv

自动安装

$ apt search firacode
正在排序... 完成
全文搜索... 完成  
fonts-firacode/未知,未知,now 1.206+dfsg1-4 all [已安装]
  Monospaced font with programming ligatures

texlive-latex-extra/未知,未知 2018.20190227-2 all
  TeX Live: LaTeX additional packages

$ sudo apt install fonts-firacode
$ sudo apt remove fonts-firacode

9 开机挂载磁盘

如果电脑安装的是windows+linux双系统,当开机使用linux系统时,很多时候都需要访问原来windows系统磁盘分区中的文件,一般操作比较麻烦。可以通过设置开机挂载磁盘分区的方式简化操作。

fy@fy-PC:~$ sudo fdisk -l 
Disk /dev/loop0:55.43 MiB,58114048 字节,113504 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
...


Disk /dev/nvme0n1:232.91 GiB,250059350016 字节,488397168 个扇区
Disk model: Asgard AN2 250NVMe-M.2/80               
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:gpt
磁盘标识符:144EF218-073A-4F5B-8758-53728FAEF8B2

设备                起点      末尾      扇区   大小 类型
/dev/nvme0n1p1      2048   1023999   1021952   499M Windows 恢复环境
/dev/nvme0n1p2   1024000   1228799    204800   100M EFI 系统
/dev/nvme0n1p3   1228800   1261567     32768    16M Microsoft 保留
/dev/nvme0n1p4   1261568 404510719 403249152 192.3G Microsoft 基本数据
/dev/nvme0n1p5 404510720 488396799  83886080    40G Linux 文件系统


Disk /dev/sda:931.53 GiB,1000204886016 字节,1953525168 个扇区
Disk model: HGST HTS721010A9
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
磁盘标识符:0DE21473-5858-9090-8081-828310111213

设备             起点       末尾      扇区   大小 类型
/dev/sda1        2048  868732927 868730880 414.2G Microsoft 基本数据
/dev/sda2  1078450176 1506070526 427620351 203.9G Microsoft 基本数据
/dev/sda3  1506072576 1925502975 419430400   200G Microsoft 基本数据
/dev/sda4  1925505024 1953523710  28018687  13.4G Microsoft 基本数据
/dev/sda5   868732928 1046466559 177733632  84.8G Linux 文件系统
/dev/sda6  1046466560 1078450175  31983616  15.3G Linux swap

分区表记录没有按磁盘顺序。
...

通过输出可以看到,我电脑上有两块硬盘:

  • Disk /dev/nvme0n1:232.91 GiB
  • Disk /dev/sda:931.53 GiB

在较大的那一块硬盘上,有两个分区

/dev/sda2  1078450176 1506070526 427620351 203.9G Microsoft 基本数据
/dev/sda3  1506072576 1925502975 419430400   200G Microsoft 基本数据

在这两个分区中存储了我平时使用的很多文件,那么我就可以通过修改文件/etc/fstab的内容,设置开机挂载这两个分区

fy@fy-PC:~$ cat /etc/fstab
## /etc/fstab: static file system information.
##
## Use 'blkid' to print the universally unique identifier for a
## device; this may be used with UUID= as a more robust way to name devices
## that works even if disks are added and removed. See fstab(5).
##
## <file system> <mount point>   <type>  <options>       <dump>  <pass>
## / was on /dev/nvme0n1p5 during installation
UUID=8cb3c766-3827-4f1f-a2fb-0e2cea44106f /               ext4    errors=remount-ro 0       1
## /boot/efi was on /dev/nvme0n1p2 during installation
UUID=6096-D629  /boot/efi       vfat    umask=0077      0       1
## /home was on /dev/sda5 during installation
UUID=520aab2d-910c-433a-8bbc-9a9572333138 /home           ext4    defaults        0       2
## swap was on /dev/sda6 during installation
UUID=a7858ddc-ff52-42a0-af6e-24eb1aa7eb96 none            swap    sw              0       0
/dev/sda2                                 /mnt/e          ntfs    defaults        0       0
/dev/sda3                                 /mnt/f          ntfs    defaults        0       0

可以在此文件的最后添加想要挂载的磁盘分区

/dev/sda2     /mnt/e     ntfs      defaults       0       0
/dev/sda3     /mnt/f     ntfs      defaults       0       0
[设备/UUID等]  [挂载点]  [文件系统]  [文件系统参数]  [dump]  [fsck]

其中需要注意的只有前三列,后面三列直接 defaults 0 0 即可

那么以后开机系统就会自动挂载对应的分区。访问时可通过如下方式访问

fy@fy-PC:~$ ll /mnt/f
总用量 32
drwxrwxrwx 1 root root  4096 6月  23 09:17  ./
drwxr-xr-x 4 root root  4096 6月  19 12:08  ../
drwxrwxrwx 1 root root     0 2月  28 09:59 '$RECYCLE.BIN'/
drwxrwxrwx 1 root root     0 3月  16 21:39  bats/
drwxrwxrwx 1 root root     0 3月  14 19:52  box/
drwxrwxrwx 1 root root 12288 6月  19 11:18  fdm_download/
drwxrwxrwx 1 root root     0 3月  14 21:25  .freedownloadmanager/
drwxrwxrwx 1 root root  4096 6月  24 09:49  linux/
drwxrwxrwx 1 root root  4096 2月  28 10:02  program_files/
drwxrwxrwx 1 root root  4096 2月  28 10:02 'System Volume Information'/
drwxrwxrwx 1 root root     0 3月  14 19:52  temp/

10 安装KDE桌面

$ sudo apt install kubuntu-desktop

注销并重新登陆,点击桌面右下角的齿轮图标,选择kde

11 安装nodejs

下载nodejs
https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.xz

$ sudo tar -xvf node-v16.13.2-linux-x64.tar.xz -C /opt
$ touch ~/.bash_aliases
$ echo 'export PATH=$PATH:/opt/node-v16.13.2-linux-x64/bin
$ source ~/.bash_aliases
$ node -v
v16.13.2
$ npm -v
8.1.2

12 fish shell设置环境变量

fy@fy-vm ~> ## 格式:set PATH $PATH 要添加的值。如:
fy@fy-vm ~> set PATH $PATH /home/fy/test/bin
fy@fy-vm ~> 
fy@fy-vm ~> echo $PATH
/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/fy/test/bin

13 创建新用户

方式一:

root@fy-server:~## useradd user1 -m -s /bin/bash
root@fy-server:~## passwd user1
New password:
Retype new password:
passwd: password updated successfully
root@fy-server:~##

-m 自动在/home目录下创建用户的家目录
-s 指定用户所使用的shell

方式二:

root@fy-server:~## adduser user2
Adding user `user2' ...
Adding new group `user2' (1002) ...
Adding new user `user2' (1002) with group `user2' ...
Creating home directory `/home/user2' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for user2
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
root@fy-server:~##
root@fy-server:~## grep user* /etc/passwd
user1:x:1001:1001::/home/user1:/bin/bash
user2:x:1002:1002:,,,:/home/user2:/bin/bash

使用adduser命令,此命令会自动为用户创建家目录,并提示设置密码。

14 ubuntu 设置静态ip

https://netplan.io/reference/#examples

14.1 单网卡配置

注:这里使用的ubuntu版本为ubuntu server 22.04

这里为了演示,首先将vmware内ubuntu系统的网络连接方式改为桥接,然后再手动为其配置ip。

1、查看本机ip信息

## 打开 powershell
PS C:\Users\Administrator\Desktop> ipconfig /all
...
以太网适配器 以太网:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Intel(R) Ethernet Connection (7) I219-LM
   物理地址. . . . . . . . . . . . . : 00-D8-61-99-C1-11
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::eca5:7268:61dc:88ce%19(首选)
   IPv4 地址 . . . . . . . . . . . . : 192.168.131.242(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   IPv4 地址 . . . . . . . . . . . . : 192.168.132.242(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   IPv4 地址 . . . . . . . . . . . . : 192.168.134.242(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.131.254
                                       192.168.132.254
                                       192.168.134.254
   DHCPv6 IAID . . . . . . . . . . . : 335599713
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-25-8D-CB-3A-00-D8-61-99-C1-11
   DNS 服务器  . . . . . . . . . . . : 211.138.24.66
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用
   ...

获取以下信息:

   IPv4 地址 . . . . . . . . . . . . : 192.168.131.242(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.131.254
   DNS 服务器  . . . . . . . . . . . : 211.138.24.66

2、将ubuntu server的网络连接模式设置为桥接(虚拟机ip和主机ip在同一个子网中),然后修改
/etc/netplan/**.yaml,为虚拟机手动设置静态ip。

在这里插入图片描述
通过第一步的信息可知,本机ip所在子网为192.168.131.0,所以下面为虚拟机内系统分配ip时也将ip(192.168.131.111)配置在了这个子网ip范围内。

fy@fy-server:~$ sudo vim /etc/netplan/00-installer-config.yaml
fy@fy-server:~$ cat /etc/netplan/00-installer-config.yaml
## This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: false
      addresses: [192.168.131.111/24]
      gateway4: 192.168.131.254
      nameservers:
        addresses: [211.138.24.66]
  version: 2

在这里插入图片描述
修改完成之后保存文件,然后执行sudo netplan apply

14.2 多网卡配置

注:以下在虚拟机中实验,OS版本为ubuntu server 22.04,网络连接方式为NAT

fy@fy-server ~> sudo vim /etc/netplan/00-installer-config.yaml
## This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      dhcp4: true
    ens38:
      addresses: [10.128.0.17/8]
      routes:
      - to: default
        via: 10.0.0.2
        metric: 101
      nameservers:
        addresses: [10.0.0.2]
    ens39:
      addresses: [10.128.0.20/8]
      routes:
      - to: default
        via: 10.0.0.2
        metric: 102
      nameservers:
        addresses: [10.0.0.2]
  version: 2
fy@fy-server ~> sudo netplan apply
fy@fy-server ~> ip route show
default via 10.0.0.2 dev ens33 proto dhcp src 10.128.0.16 metric 100
default via 10.0.0.2 dev ens38 proto static metric 101
default via 10.0.0.2 dev ens39 proto static metric 102
10.0.0.0/8 dev ens38 proto kernel scope link src 10.128.0.17
10.0.0.0/8 dev ens39 proto kernel scope link src 10.128.0.20
10.0.0.0/8 dev ens33 proto kernel scope link src 10.128.0.16 metric 100
10.0.0.2 dev ens33 proto dhcp scope link src 10.128.0.16 metric 100
fy@fy-server ~> ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:26:71:43 brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 10.128.0.16/8 metric 100 brd 10.255.255.255 scope global dynamic ens33
       valid_lft 1476sec preferred_lft 1476sec
    inet6 fe80::20c:29ff:fe26:7143/64 scope link
       valid_lft forever preferred_lft forever
3: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:26:71:4d brd ff:ff:ff:ff:ff:ff
    altname enp2s6
    inet 10.128.0.17/8 brd 10.255.255.255 scope global ens38
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe26:714d/64 scope link
       valid_lft forever preferred_lft forever
4: ens39: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:26:71:57 brd ff:ff:ff:ff:ff:ff
    altname enp2s7
    inet 10.128.0.20/8 brd 10.255.255.255 scope global ens39
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe26:7157/64 scope link
       valid_lft forever preferred_lft forever
fy@fy-server ~>

15 更换用户的shell

## 查看可用的shell
fy@fy-server:~$ cat /etc/shells
## /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/usr/bin/sh
/bin/dash
/usr/bin/dash
/usr/bin/tmux
/usr/bin/screen
/usr/bin/fish

## 查看当前使用的shell
fy@fy-server:~$ echo $SHELL
/bin/bash

## 更换到想用的shell
fy@fy-server:~$ chsh -s /usr/bin/fish
Password:

## 重新打开一个终端,即可使更改生效
fy@fy-server ~> echo $SHELL
/usr/bin/fish

2 linux

1 手动rm删除yum源后,无法再次添加yum源

问题:在安装mysql时,添加了mysql的yum源。后来不需要了,于是手动删除了目录/etc/yum.repos.d中的mysql的repo,但是后来再次添加此源时,无法添加,且无法安装mysql

[fy@localhost yum.repos.d]$ ls
CentOS-Base.repo      CentOS-CR.repo         CentOS-fasttrack.repo  CentOS-Sources.repo  CentOS-x86_64-kernel.repo       mysql-community.repo
CentOS-Base.repo.bak  CentOS-Debuginfo.repo  CentOS-Media.repo      CentOS-Vault.repo    mysql-community-debuginfo.repo  mysql-community-source.repo

[fy@localhost yum.repos.d]$ sudo rm mysql*

[fy@localhost yum.repos.d]$ ls
CentOS-Base.repo  CentOS-Base.repo.bak  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo  CentOS-x86_64-kernel.repo
# 再次安装时无法安装
[fy@localhost ~]$ sudo yum install ./mysql80-community-release-el7-6.noarch.rpm
Loaded plugins: fastestmirror, langpacks
Examining ./mysql80-community-release-el7-6.noarch.rpm: mysql80-community-release-el7-6.noarch
./mysql80-community-release-el7-6.noarch.rpm: does not update installed package.
Error: Nothing to do

[fy@localhost ~]$ sudo yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package mysql-community-server available.
Error: Nothing to do

[fy@localhost ~]$

解决:首先使用rpm -e卸载对应的软件包,然后再次添加

[fy@localhost ~]$ ls
Desktop  Documents  Downloads  Music  mysql80-community-release-el7-6.noarch.rpm  Pictures  Public  Templates  Videos  VNC-Server-6.9.1-Linux-x64.rpm

[fy@localhost ~]$ sudo yum install ./mysql80-community-release-el7-6.noarch.rpm
[sudo] password for fy:
Loaded plugins: fastestmirror, langpacks
Examining ./mysql80-community-release-el7-6.noarch.rpm: mysql80-community-release-el7-6.noarch
./mysql80-community-release-el7-6.noarch.rpm: does not update installed package.
Error: Nothing to do

# mysql80-community-release-el7-6.noarch 为上述输出得到。或者 rpm -qa |grep mysql
[fy@localhost ~]$ sudo rpm -e mysql80-community-release-el7-6.noarch
warning: file /etc/yum.repos.d/mysql-community.repo: remove failed: No such file or directory
warning: file /etc/yum.repos.d/mysql-community-source.repo: remove failed: No such file or directory
warning: file /etc/yum.repos.d/mysql-community-debuginfo.repo: remove failed: No such file or directory

# 再次添加源并安装mysql就行了
[fy@localhost ~]$ sudo yum install ./mysql80-community-release-el7-6.noarch.rpm
[fy@localhost ~]$ sudo yum install mysql-community-server
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值