【Linux】配置

修改 hostname

1
2
vi /etc/hostname
reboot

Linux Basics - Set a Static IP on Ubuntu

Here is an example for an older Ubuntu Release:

1
2
3
4
5
6
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

And here an example for Ubuntu 16.04 and newer:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# test

# The primary network interface
auto ens33
iface ens33 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

Changing ubuntu server’s language to english

1
sudo apt-get install language-pack-en language-pack-en-base manpages
1
2
# /etc/default/locale
LANG="en_US.UTF-8"
1
2
## OR
sudo update-locale LANG=en_US.UTF-8

build-essential

1
apt-get install build-essential

or

1
2
sudo apt-get install aptitude
sudo aptitude install build-essential

switch between gdm,lightdm

http://www.webupd8.org/2011/07/how-to-switch-between-gdm-lightdm-or.html

1
sudo dpkg-reconfigure lightdm

[How can I define startup applications with the Awesome Window Manager? - Ask Ubuntu](

https://askubuntu.com/questions/57264/how-can-i-define-startup-applications-with-the-awesome-window-manager)

Starting from a template
First you’ll need to copy the template rc.lua file into your home folder

1
2
mkdir ~/.config/awesome
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/

Defining applications to start
Now using awesome - edit config copy the following code at the bottom of your new rc.lua file

1
2
3
4
5
6
7
8
9
10
11
do
local cmds =
{
"firefox",
"xedit"
}

for _,i in pairs(cmds) do
awful.util.spawn(i)
end
end

In this example - firefox and xedit are run on startup.
An excellent wiki page describing this and much more can be found on ArchLinux

rootlogin

root 账号不能登录,提示 ssh permission denied 问题

1
2
3
4
5
vi /etc/ssh/sshd_config
# add below line
PermitRootLogin yes
# then restart sshd
service sshd restart

ubuntu 设置静态网络

  1. 修改 /etc/netplan/00-installer-config.yaml
1
2
3
4
5
6
7
8
9
10
11
network:
version: 2
# renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.137.15/24]
gateway4: 192.168.137.1
nameservers:
# search: [itzgeek.local]
addresses: [233.5.5.5, 233.6.6.6]
  1. 执行命令:netplay apply 即可生效