- 配置ssh访问
- 配置sudo免密码
- 备份并替换ubuntu源
- 更新并安装build-essential
- 安装virtualbox增强工具
- 设置共享文件夹
- 安装mysql server
- .bashrc设置
- mysql_update
- 桥接网络设置
- Ubuntu Server只安装安全更新(未验证)
- apt命令参考
1 | virtualbox设置 |
https://askubuntu.com/questions/147241/execute-sudo-without-password
https://blog.csdn.net/wxqee/article/details/72718869
https://www.linuxidc.com/Linux/2016-12/139018.htm
https://blog.csdn.net/javensun/article/details/7582341
https://www.jb51.net/os/Ubuntu/63313.html1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44sudo visudo
# 在文件末尾添加如下语句,USER替换为不需要输入密码的用户名
USER ALL=(ALL) NOPASSWD: ALL
# 上面的命令其实是修改了/etc/sudoers文件,所以也可以直接编辑这个文件
sudo vi /etc/sudoers
添加如下语句
USER ALL=(ALL) NOPASSWD: ALL
hogan@ubuntu:/etc$ cat /etc/sudoers
cat: /etc/sudoers: Permission denied
hogan@ubuntu:/etc$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
hogan ALL=(ALL) NOPASSWD: ALL
1 | cd /etc/apt/ |
1 | sudo apt-get update |
1 | cd /mnt/ |
https://www.cnblogs.com/lidabo/p/5317024.html
http://www.cnblogs.com/linjiqin/p/3615477.html1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51virtualbox设置
设置--共享文件夹--设置目录(固定分配勾选,注意把自动挂载选项去掉,Ubuntu不能勾选自动挂载,Windows可以勾选自动挂载)
ubuntu设置
cd /mnt
sudo mkdir shared
sudo mount -t vboxsf share /mnt/shared
其中"share"是之前创建的共享文件夹的名字。OK,现在Ubuntu和主机可以互传文件了。
要想自动挂载的话,可以在/etc/fstab中添加一项
share /mnt/shared vboxsf rw,gid=100,uid=1000,auto 0 0
卸载的话使用下面的命令:
sudo umount -f /mnt/shared
注意事项
共享文件夹的名称千万不要和挂载点的名称相同。比如,上面的挂载点是/mnt/shared,如果共享文件夹的名字也是shared的话,在挂载的时候就会出现如下的错误信息:/sbin/mount.vboxsf: mounting failed with the error: Protocol error
自用Ubuntu上的实际配置
cd /mnt
sudo mkdir share
sudo mount -t vboxsf Ubuntu /mnt/share
sudo vi /etc/fstab
/etc/fstab添加如下语句
Ubuntu /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0
*****20200621 update*****
在实际使用中,因为系统调用fstab的时候,Virtualbox的共享目录的模块还没有加载,所以每次加载都会失败
以下是ubuntu 16上实际使用方式
1. 设置--共享文件夹--设置目录(固定分配勾选,注意把自动挂载选项去掉,Ubuntu不能勾选自动挂载,Ubuntu不能勾选自动挂载,Ubuntu不能勾选自动挂载,重要的事说三遍。。。
2. 修改/etc/rc.local,把mount的语句加在rc.local中,rc.local是最后执行的开机启动任务,所以这时候virtualbox的相关模块已启动,不会导致加载失败的问题,值得注意的是,一定要把virtualbox设置中的自动挂载去掉
hogan@ubuntu:~$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
mount -t vboxsf ubuntu /mnt/share
mount -t vboxsf codes /mnt/repository
exit 0
1 | 由于系统源中的mysql版本过低,所以需要先去mysql官网下载apt源的deb包 |
1 | alias condapython='~/anaconda3/bin/python' |
1 | hogan@ubuntu:~$ cat bin/mysql_update |
1 | 不知道是否路由器的原因,桥接网络有时候不能获取IP地址,但是这时候重启Host电脑,然后再打开虚拟机启动guest,就能够获取IP了,如果还不行,可以在桥接网络设置,混杂模式切换试试 |
https://linux.cn/article-8060-1.html
https://yq.aliyun.com/articles/113684
https://blog.ghostry.cn/server/753.html
https://ox0spy.github.io/post/configuration/debian-ubuntu-automatic-security-updates/
http://blog.topspeedsnail.com/archives/10299
https://www.howtoing.com/install-security-updates-ubuntu-debian/
https://www.cplusplus.me/2443.html
1 | apt-cache search package 搜索包 |