Command 'vim' not found, but can be installed with: sudo apt install vim # version 2:8.2.3995-1ubuntu2.3, or sudo apt install vim-tiny # version 2:8.2.3995-1ubuntu2.3 sudo apt install vim-athena # version 2:8.2.3995-1ubuntu2.3 sudo apt install vim-gtk3 # version 2:8.2.3995-1ubuntu2.3 sudo apt install vim-nox # version 2:8.2.3995-1ubuntu2.3 sudo apt install neovim # version 0.6.1-3
我们可以按照提示,执行sudo apt install vim,安装vim。
文件目录:ll
在CentOS和Ubuntu,ll都是一个别名。
在CentOS,type ll,内容是ll is aliased to `ls -l --color=auto'。
在Ubuntu,type ll,内容是ll is aliased to `ls -alF'
-F:在列出的文件名称后加一符号;例如可执行档则加*, 目录则加/。
没加-F,示例代码:
1
ls
运行结果:
1
Desktop Documents Downloads Music Pictures Public snap Templates Videos
Command 'ifconfig' not found, but can be installed with: sudo apt install net-tools
如运行结果所示,执行命令sudo apt install net-tools,进行安装。
curl
示例代码:
1
curl kakawanyifan.com
运行结果:
1 2 3 4
Command 'curl' not found, but can be installed with: sudo snap install curl # version 7.87.0, or sudo apt install curl # version 7.81.0-1ubuntu1.7 See 'snap info curl' for additional versions.
● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2023-02-05 10:08:42 CST; 2h 12min ago Docs: man:sshd(8) man:sshd_config(5) Process: 8379 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Main PID: 8380 (sshd) Tasks: 1 (limit: 2279) Memory: 29.4M CPU: 1.021s CGroup: /system.slice/ssh.service └─8380 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
2月 05 11:35:49 kaka-Parallels-Virtual-Platform sshd[84325]: Accepted password for u2 from 10.211.55.2 port 59499 ssh2 2月 05 11:35:49 kaka-Parallels-Virtual-Platform sshd[84325]: pam_unix(sshd:session): session opened for user u2(uid=999) by (uid=0) 2月 05 11:41:08 kaka-Parallels-Virtual-Platform sshd[99575]: Accepted password for u3 from 10.211.55.2 port 59900 ssh2 2月 05 11:41:08 kaka-Parallels-Virtual-Platform sshd[99575]: pam_unix(sshd:session): session opened for user u3(uid=1002) by (uid=0) 2月 05 11:45:57 kaka-Parallels-Virtual-Platform sshd[120408]: Accepted password for u33 from 10.211.55.2 port 60182 ssh2 2月 05 11:45:57 kaka-Parallels-Virtual-Platform sshd[120408]: pam_unix(sshd:session): session opened for user u33(uid=1003) by (uid=0) 2月 05 12:06:11 kaka-Parallels-Virtual-Platform sshd[181223]: Accepted password for root from 10.211.55.2 port 61588 ssh2 2月 05 12:06:11 kaka-Parallels-Virtual-Platform sshd[181223]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0) 2月 05 12:07:35 kaka-Parallels-Virtual-Platform sshd[185358]: Accepted password for kaka from 10.211.55.2 port 61673 ssh2 2月 05 12:07:35 kaka-Parallels-Virtual-Platform sshd[185358]: pam_unix(sshd:session): session opened for user kaka(uid=1000) by (uid=0)
● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2023-02-05 10:08:42 CST; 2h 12min ago Docs: man:sshd(8) man:sshd_config(5) Process: 8379 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) Main PID: 8380 (sshd) Tasks: 1 (limit: 2279) Memory: 29.4M CPU: 1.021s CGroup: /system.slice/ssh.service └─8380 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
2月 05 11:35:49 kaka-Parallels-Virtual-Platform sshd[84325]: Accepted password for u2 from 10.211.55.2 port 59499 ssh2 2月 05 11:35:49 kaka-Parallels-Virtual-Platform sshd[84325]: pam_unix(sshd:session): session opened for user u2(uid=999) by (uid=0) 2月 05 11:41:08 kaka-Parallels-Virtual-Platform sshd[99575]: Accepted password for u3 from 10.211.55.2 port 59900 ssh2 2月 05 11:41:08 kaka-Parallels-Virtual-Platform sshd[99575]: pam_unix(sshd:session): session opened for user u3(uid=1002) by (uid=0) 2月 05 11:45:57 kaka-Parallels-Virtual-Platform sshd[120408]: Accepted password for u33 from 10.211.55.2 port 60182 ssh2 2月 05 11:45:57 kaka-Parallels-Virtual-Platform sshd[120408]: pam_unix(sshd:session): session opened for user u33(uid=1003) by (uid=0) 2月 05 12:06:11 kaka-Parallels-Virtual-Platform sshd[181223]: Accepted password for root from 10.211.55.2 port 61588 ssh2 2月 05 12:06:11 kaka-Parallels-Virtual-Platform sshd[181223]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0) 2月 05 12:07:35 kaka-Parallels-Virtual-Platform sshd[185358]: Accepted password for kaka from 10.211.55.2 port 61673 ssh2 2月 05 12:07:35 kaka-Parallels-Virtual-Platform sshd[185358]: pam_unix(sshd:session): session opened for user kaka(uid=1000) by (uid=0)
软件包:apt
最后一个话题,也是Ubuntu和CentOS在操作上最主要的差异,软件包。
在CentOS,我们说有:RPM,RedHat Package Manager,红帽软件包管理;YUM,Yellow dog Updater,Modified,软件包管理器,基于RPM。
同时,在《1.简介、目录和VIM》,我们就讨论过,CentOS和Ubuntu隶属于不同的分支,CentOS隶属于RedHat分支,Ubuntu隶属于debian分支。所以,.rpm的包,在Ubuntu上是无法使用的。
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted
mysql-server/jammy-updates,jammy-updates,jammy-security,jammy-security 8.0.32-0ubuntu0.22.04.2 all MySQL database server (metapackage depending on the latest version)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1306058 (unattended-upgr) Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1306058 (unattended-upgr) Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1306058 (unattended-upgr)
Press <enter> to keep the current choice[*], or type selection number:
但是我们在JDK19的安装目录下,能成功运行java -version。
示例代码:
1 2
cd /usr/lib/jvm/jdk-19-oracle-x64/bin ./java -version
运行结果:
1 2 3
java version "19.0.2" 2023-01-17 Java(TM) SE Runtime Environment (build 19.0.2+7-44) Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)