When installing the Linux Ubuntu server, you can select Chinese characters for installation. After the installation, you can find that the results of many commands are garbled. Now, you only need to switch to "en_us" and display it in English, it is better than garbled characters.
Sudo Vim/var/lib/locales/supported. d/local change to en_US.UTF-8 UTF-8frank @ Ubuntu-server :~ $ Sudo Vim/etc/default/locale change the following content to Lang = "zh_CN.UTF-8" Language = "zh_cn: ZH" to: lang = "en_US.UTF-8" Language = "en_us: en "there are many lines of text below, which can be set as needed. I replaced all "zh_cn" with "en_us ". Then the date and Cal commands are used to show that English is not messy. Frank @ Ubuntu-server :~ $ Sudo locale-gen generating locales... en_US.UTF-8... done zh_CN.UTF-8... up to-date zh_HK.UTF-8... up to-date zh_SG.UTF-8... up to-date zh_TW.UTF-8... up-to-dategeneration complete.
Remember
Reboot
I installed Ubuntu today but found that I cannot access the Internet. I started to troubleshoot the problem:
1. First, check whether the network connection is correct and whether the network cable used works properly.
2. Check whether the network card works properly. The detection method is as follows:
A. Ping 127.0.0.1
B. Ping the static gateway address
C. Ping the Host Name (hostname indicates the host name)
3. Check whether the NIC address is correctly configured. (The ifconfig command checks the NIC information of the local host and compares it with the DNS, default getway, and sever addresses to check whether the NIC address is correct)
My device has a problem in the third aspect. Then, modify the NIC configuration information and run the following command: (of course, you can use the graphic window. I only use it to learn about Linux)
1. Use commands to set the IP address of ubuntu
1. modify the configuration file blacklist. conf to disable IPv6:
Sudo VI/etc/modprobe. d/blacklist. conf
2. Add blacklist IPV6 at the end of the document and view the Modification result:
CAT/etc/modprobe. d/blacklist. conf
3. Set the IP address (set the IP address and subnet mask of the network adapter eth0)
Sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0
4. Set the Gateway
Sudo route add default GW 192.168.2.254
5. Set DNS modification to/etc/resolv. conf and add nameserver DNS address 1 and nameserver DNS address 2.
6. Restart the network service (if not, restart Ubuntu: sudo reboot ):
Sudo/etc/init. d/networking restart
7. view the current IP Address:
Ifconfig
2. directly modify the Ubuntu Linux configuration file
The Network Ubuntu Linux configuration file is:/etc/Network/interfaces
After it is enabled, you can set DHCP or manually set static IP addresses. In front of auto eth0, enable automatic Nic mounting.
1. Configure the NIC in DHCP Mode
Edit the file/etc/Network/interfaces:
Sudo VI/etc/Network/interfaces
Replace eth0 with the following rows:
# The primary network interface-use DHCP to find our address
Auto eth0
Iface eth0 Inet DHCP
Run the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart
You can also enter the following command in the command line to obtain the address.
Sudo dhclient eth0
2. configure a static IP address for the NIC
Edit the file/etc/Network/interfaces:
Sudo VI/etc/Network/interfaces
Replace eth0 with the following rows:
# The primary network interface
Auto eth0
Iface eth0 Inet static
Address 192.168.2.1
Gateway 192.168.2.254
Netmask 255.255.255.0
# Network 192.168.2.0
# Broadcast 192.168.2.255
Replace the preceding IP address and other information with your own. Use the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart
3. Set the second IP address (virtual IP address)
Edit the file/etc/Network/interfaces:
Sudo VI/etc/Network/interfaces
Add the following lines to the file:
Auto eth0: 1
Iface eth0: 1 Inet static
Address x. x
Netmask x. x
Network x. x
Broadcast x. x
Gateway x. x
Fill in all information such as address, netmask, network, broadcast, and gateways according to your situation:
Run the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart
4. Set Host Name (hostname)
Run the following command to view the Host Name of the current host:
Sudo/bin/hostname
Run the following command to set the Host Name of the current host:
Sudo/bin/hostname newname
When the system starts, it reads the host name from/etc/hostname.
5. Configure DNS in Ubuntu Linux
First, you can add some host names to/etc/hosts and the IP addresses corresponding to these host names. This is a simple static query on the local machine. To access the DNS server for query, you need to set the/etc/resolv. conf file. If the IP address of the DNS server is 192.168.2.2, the content of the/etc/resolv. conf file should be:
Search chotim.com
Nameserver 192.168.2.2
6. Manually restart the network service:
Sudo/etc/init. d/networking restart
Of course, Ubuntu has a graphical interface, so the preceding address settings can also be completed by setting like windows. In the upper part of the window, system-> preference should find the corresponding configuration options; in addition, it is inconvenient to use the command line to modify the configuration file when vi commands are used. Therefore, you can use gedit to edit the configuration file.