Using dnspod and squid to build their own CDN (d) _linux

Source: Internet
Author: User
Tags mkdir save file ssh centos

1. Basic Installation

Plug the disc into the optical drive, set the BIOS to boot from the CD drive (Don't tell me you won't), and then you'll see the startup interface with some hints that you can enter some commands for advanced installation or to enter system Repair mode. No tube, just press ENTER.


Wait a minute, there will be an interface that requires you to do a disc integrity check. Generally speaking, the disc will not have bad, unless it is downloaded from the ISO file has problems. So here we skip.


Skip the method is: Press the Keyboard tab to select the control, the selected control will be highlighted, we choose skip (we suggest that everyone at any time to open translation tools or Web site to do not understand the English translation), and then press the space bar to confirm.

Then wait a minute and we can see the graphical interface installed.

Press Next to select the installation language. Because the Linux support for Chinese is not good, the dark character interface if the Chinese words will have garbled (although the remote connection up to see, but the server once the failure, need to operate in the computer room, you will find the default English is how important), So let's choose the default English (Chinese) and then press the next step.

The next option is to select the keyboard style. I believe everyone's keyboard is English instead of Japanese (have played notebook have seen parallel IBM? The top one is a Japanese keyboard, so leave the default U.S. 中文版. What the? You happen to have a parallel IBM outfit? It still has to be in English, otherwise the word out of the mess don't blame me.

Next, it's your turn to choose how to install. Because we are the new installation, so we choose the first install CentOS, next.

The next question is how to partition. Firmly do not use a partition to install all files, or let the system automatically divided. We insist that all partitions are divided by themselves. This effectively avoids situations in which all data cannot be recovered if a single partition is having problems. (Hard to understand?) It's just like the problem with the C disk in Windows. C disk is a serious problem can not read, but the use of the tool disk to boot the system, Access D, E and other disks, to recover the data.

We choose Create custom Layout in the Pull-down menu (creating a customized layout), and next.

Then see the current machine above the hard drive, all Linux devices are in directory/dev below, the normal IDE hard disk is the identification of HD (SCSI, SATA is SD), the first hard disk is a, the second is B, so on. So if you're using a normal IDE hard disk and then connected to the location of the first IDE line master, then the hard drive's logo is/dev/hda. If it is a SATA hard drive, then generally is/DEV/SDA. If the optical drive is IDE and is connected to another IDE line main device port, it is usually/dev/hdc.
In addition, we have to know about the partitioning of Linux. Everyone will feel strange, Windows has C disk, D disk, why Linux does not? How does the partitioning of Linux exist?
In fact, in Linux, each partition is treated as a directory. All directories start from/(root) and grow in tree shape. The specific situation you can go to refer to the relevant information, here do not do more elaboration. This is one of the biggest benefits for us: A directory partition space is used up, we only need to install a large hard drive, and then the whole of the hard drive into a zone, loaded inside the system, the directory inside the file all copied in, as the directory, so not afraid of space is not enough.
Then talk about the file system of the partition. Friends with Windows must have known fat32,ntfs, right? Linux the most commonly used file system is ext3 and ReiserFS, there are older ext2, now very few people use, there are swap, swap partition. Several file systems are not the pros and cons, the text is used ext3, because CentOS to ext3 support than ReiserFS to better.

The basic Linux system includes the following directories
/root partition, if you want to divide the entire hard drive into one area, then divide the area
/bin,/sbin are some of the commands that are used.
/boot Drop Boot file
/usr includes some files that are not frequently changed, such as commands, libraries, help, and so on
/usr/local ditto, general new programs are installed here, just like Windows program files
/var are files that are constantly changing, such as log
/home See the name, you know where the user lives.
/etc inside are all setup files that have a similar effect to the registry
/lib shared libraries, so files, function like a Windows DLL file. When you open it, you'll see some numbers, actually the version number.
/root the place where the eldest brother lives, will be mentioned later

Here are a few of the more specific directories
SWAP See clearly, not in front of/. Swap is the swap partition, which is the virtual memory inside windows, but the difference is basically not used. Partitions only need to be divided into one, do not need to set mount point, the file system selection is OK.
/dev storage device system, belonging to virtual file system
/proc holds process information and is also a virtual file system. You can modify the kernel or process in real time through this file system, that is, interaction. For example, you can view the use of memory in real time, CPU information
The back two do not understand it does not matter, we first to partition.

The above picture can be seen, the hard disk original partition, we put/dev/hda selected, and then click on the menu above delete the entire deletion.
Then we click on the menu new, start partitioning, first one/, file system selection Ext3, partition size is 1G, that is 1024M.
Mount point is mount points, input/
File system type filesystem, select Ext3 in dropdown
Size partition sizes, in MB, enter 1024
Press OK when finished
With swap, click New, select Swap,size input 2048 directly in the file System type, press OK

The rest of the partitions are divided by the following
/1024
Swap 2048
/usr 5120
/usr/local 5120
/var 5120
/tmp 2048
/usr/local/squid 1024
/var/spool/squid all the rest of the space

How do you choose all the remaining space? Very simple, choose Fill to maximum allowable size.

After division, it looks like the following
OK, after all the partitions are finished, let's move on to the next step.
A grub-mounted interface will then appear. Grub is used to start the system, including dual-system boot to use, installed in the boot when you will see a menu for you to choose from. There's nothing to change here, just the next step.
If your network card can be successfully recognized by the system, this step should be to let you configure the network card parameters.
Click Edit, the Network card configuration page appears. First remove use dynamic IP configuration (DHCP), DHCP is automatically assigned from the gateway IP, because our IP is fixed, so do not need.
Then IPv6 we do not, Enable IPv6 support also removed.
Activate on boot indicates that the NIC is automatically started after the system is started, to be selected.
Because this server is netcom use, IP is 2.2.2.2, so the address inside the input 2.2.2.2,prefix (Netmask) is a subnet mask, you can enter 255.255.255.0 or 24. 24 is a kind of address called CIDR, you can go to Google, this is not explained in depth.
The configured NIC is shown below

After saving, we also need to set the host name, here is set to Cnc.naizhao.com bar.

Then there are a few miscellaneous (Miscellaneous settings), Gateway is gateways, Primary DNS is primary dns,secondary DNS is secondary DNS, set up according to specific requirements.

Then set the time zone. Click on the top right corner of the map, then point to the location in Shanghai, the lower left corner of the Drop-down menu will become Asia/shanghai, next.

Then just set the password for root. Linux is not the same as Windows, Windows can have many administrators, Linux can only have a root, the general user to exercise the identity of the administrator, must use su This command temporarily change the identity as an administrator.

Enter the password two times to confirm the next step.

The next option is to choose the installation type. Remove all desktop and hook up in front of the server. There will be a line of prompts to ask you when you want to make a detailed configuration of the packages you have installed (you can further customize the software selection now, or after install via the software mana Gement application), selected customize now. Next.

Then the installation package selection interface. There will be desktop environments/applications/development on the left. Follow the list below to select:

* Desktop Environments
-Remove All
* Applications
-Editors Selected
-All the rest is removed
* Development
-Development Libraries selected
-Development Tools selected
-All the rest is removed
* Servers
-Remove All
* Base System
-Dialup Networking Support removed
* All others are the default

Next, start the installation. Wait for the installation to complete and reboot.

2. Initial start-up
When the initial start, there will be a set agent, and installation requirements to detect the CD integrity of the interface, with the upper and lower keys to select firewall configuration, click the TAB key, space entry.

Then select disabled at security level, which is to turn off the firewall, tab to select OK, and space to exit. The system will then continue to boot until the login interface appears.

CentOS Release 5 (Final)
Kernel 2.6.18-8.el5 on a i686
CNC Login:

3. Remote connection
The remote connection mode of Linux is SSH. SSH is an encrypted connection, all data exchange will be encrypted, even if the server is not afraid of ARP attack password will be monitored.

SSH client under Windows, we generally use putty. Because putty too easy to use, so there are Taiwan's netizens have been modified and localized, the release of the program name is called Pietty.

Pietty's official website is: http://www.csie.ntu.edu.tw/~piaip/pietty/
Download address is: Http://www.csie.ntu.edu.tw/~piaip/pietty/stable/pietty0327.exe

Download back to run, and then enter the server's IP, carriage return can be connected. If you are connecting to the server for the first time, the program will also prompt you to accept and save the server's certificate, and select Yes. Then follow the prompts to enter the username root and password.

Basic commands for 4.Linux
The first thing to note: Linux is a case-sensitive system. No matter what you do, you should pay attention to case. CPUs and CPUs are not the same.

Say a few more commonly used

LS lists files and directories. The default is the current directory, and if you want to list the files below/bin, enter Ls/bin

CD into a directory. For example, Cd/bin can enter the/bin directory, CD. Into the previous directory, CD ABC into the current directory under the ABC directory, CD-back to the previous entry of the directory.

CP copies files or directories. CP a b copy a file as B file

mkdir to create a directory. Like MkDir Naizhao. If you want to build/a/b/c/d/e this directory, but/a/b/c/d these directories do not exist, use mkdir-p/a/b/c/d/e, then you will create these directories together.

RM deletes files or directories. RM a deletes a file. To delete a directory you must use Rm-rf A to delete the A directory

MV Mobile file. But most of the cases are used to rename files. Because Linux does not have a specially renamed command below. MV a b renamed a file B. MV A.. /move a file to the previous level directory

More useful commands. For example, using the LS command, but out of the text too much, has more than one screen, I want to see the contents of the beginning of what to see? You can use Ls|more, so you can flip the screen at will. | is the pipe, responsible for the | The results of the previous command to the order of the following. Pipes can use multiple, such as Ls-lh|grep Naizhao|more, which means that the results of the LS-LH are given to grep, and grep gives the results to more.

Grep is also a more commonly used command. Be responsible for extracting the required content. For example, I ls-lh/lib, the content is too much, not all I need, I just need to include the DNS Word content, then I use Ls-lh/lib|grep DNS. What if I need to not include DNS for three words? Using LS-LH/LIB|GREP-V DNS

Cat is not a cat. The cat command is responsible for the full output of the contents of a file. The content of the time with more use. Cat/proc/cpuinfo, for example, will show the contents of the Cpuinfo.

WC Oh, not the toilet, don't get me wrong. It's for the count. For example, I want to calculate how many rows there are in a file, then using Cat/proc/cpuinfo|wc-l, the output number is the number of cpuinfo files, the-l parameter is calculated by line. What is the most common time of this command? Look at the network connection, such as to see if the current system is being SYN, then input netstat-an|grep syn|wc-l

Netstat view the network state, generally used to see the system currently has several connections. For example, to see how many connections 80 ports have, enter NETSTAT-AN|GREP:80|WC-L

These orders advise you to play more, don't be afraid. Play bad system big heavy reload, anyway above now also have no data.

The basic use of 5.VIM
VI is a necessary tool for all UNIX systems. What's it for? Windows Notepad, you know? This thing is hundreds of times times higher than Notepad, the whole linux is basically written in VI. Vim is an improved version of VI, some systems with only VI, there is no vim. But these two things on the command is no difference, are the command line inside VI can be launched.

We have to learn the following: Open the file, edit the file, save the file

Let's take the/etc/hosts file as an example and add a 1.1.1.1 www.naizhao.com record in it.

A. Open the file
Opening the file is simple, vi file name, such as Vi/etc/hosts, and then you will see something like the following

# do don't remove the following line, or various programs
# that require network functionality would fail.
127.0.0.1 cnc.naizhao.com CNC localhost.localdomain localhost
:: 1 localhost6.localdomain6 Localhost6

B. Editing a file
Edit altogether three aspects: insert (add), modify, delete

VI inside, you can move the cursor through the keyboard's direction key. We move to
:: 1 localhost6.localdomain6 Localhost6
This line, and then press the keyboard O (letter) key, will find the cursor ran down, automatically start a new line.

Then we enter 1.1.1.1, press the tab of the keyboard two times, and then enter www.naizhao.com, but the content looks like the following
1.1.1.1 www.naizhao.com
Then we press the ESC key in the upper-left corner of the keyboard two times. When you press the first time, you will notice that the cursor jumps forward, and then press the second time, if you open the speaker, you will hear a sound.

Well, adding a new line is as simple as that.

Then, we add a record for 1.1.1.1, tel.naizhao.com, how to do it?

Move the cursor to the www.naizhao.com m and click the I (Insert) key on the keyboard so that the edit mode becomes inserted. Well, knock on a blank space to see. Ah, how to separate my com into a co m? That's not the effect I want!

No hurry, according to the previous method, press the ESC key two times, exit edit mode, and then press the keyboard u (undo) Key. Oh, yes, everything's back. The original I is inserted in front of the current text ah. Then again, the cursor moves to m above, click I, then use the keyboard to move the cursor to the right, to the back of M, to knock a space, and then enter Tel.naizhao.com, and then press two times ESC key. Well, it looks like it's a model.

Hey, I'm afraid the file was destroyed by me, want to save first, how to do?

Save the file Ah, it is very simple ah. Enter a colon (:) first. What the? Don't know how to lose? Hold down the SHIFT key and hit the semicolon on the left side of the Enter. Then the colon follows a W (write), which looks like this: W, enter. You'll see a line of hints
"/etc/hosts" 5L, 248C written
Represents the completion of a file save.

Then, uh, there's a change. If I find a wrong word, such as com o, I hit 0, how can I change?

First move the cursor to 0 above, and then press the keyboard R (replace), and then click O, haha, changed over, hurriedly: w save first.

Well... If I don't need tel.naizhao.com, how can I delete it?

What was the deletion of English? Delete it? Mobile mouse to the top of the T, click the keyboard d, and then click the right direction key, Hey, T was deleted. However, I want to delete the entire URL, one by one delete the past, is it a bit troublesome? Well, there's a point, count it with me. 1,2,3,4,5....tl.naizhao.com has a total of 14 characters, then I first click on the keyboard d, and then use the number key to enter 14 (with a special symbol that line, not a keypad) (Ah, how to enter the invisible?) And then click the right arrow, well, the world is clean. It's perfect.

In addition, there are some more convenient shortcuts, such as input DD, delete the current line, input GG, will return to the beginning of the file, input g (that is, shift+g) to the end of the file, ctrl+d to the next page, ctrl+b to the previous page, Shift+a at the end of the file inserted, shift +d Delete the current cursor position until the end of the text, these are all slowly pondering.

C. Save the file
Save file just said one: W, what if I want to save the exit directly? Can be used: Wq (write&quit), or directly: X.

However, the file has just been changed to a mess, I do not want to save, I want to exit directly, how to return?

If the file has not been changed, you can enter: Q exit. But if the file has been changed, but did not save,: Q will be an error, then you can add a Q in front!, forced to quit, just like this:!q

If the file is read-only, you have to force write, of course, you can add in front of W!

6. Set up installation update
Foreign things in the country has a very troublesome place: mirrors are abroad. Therefore, in order to upgrade the system, we must change the mirror to a domestic private mirror. As a then, the VIM knowledge that I have just learned is used again.
CentOS upgrade tool for Yum, mirrored configuration file in/etc/yum.repos.d/centos-base.repo, then, we use VI to open it.
Vi/etc/yum.repos.d/centos-base.repo
Well, there are a lot of web sites, ah, you want me to change the past one? Are you tired of me?
Not afraid, Notepad have to find replacement, VI of course, this function is also indispensable.
Yum The default is to get the mirror list from the mirrorlist= line, and since we specify a mirrored address, we need to comment this line. The way to comment is to add a # in front, which is #mirrorlist=.
Hurriedly start operation, VI inside find the replacement format is like this:%s/a/b/g, that is, find a, replace the b,g is the whole file lookup. Apply the formula, that's the way it is.
:%s/mirrorlist=/#mirrorlist =/g
Well, enter the return check, all replaced? Ha ha.
Next, specify the URL address to remove the # in front of the #baseurl=, according to the example above, to get
:%s/#baseurl =/baseurl=/g
Another OK one, the last one left.
Domestic privately built CentOS mirror image, more famous is be10.com, URL is http://mirror.be10.com/
Open the above URL, you can see a lone CentOS directory, contrast the configuration file inside the URL
http://mirror.be10.com/centos/
http://mirror.centos.org/centos/
Looking for a different game began, it seems to look, two URL difference is be10.com and centos.org, that is to say I just replace centos.org be10.com on it.
:%s/centos.org/be10.com/g
It's done. Save exit and then enter
Yum Update
Update it.

There will be interactive programs in the update process, and there will be several places where you can enter Y to confirm whether you want to install the update package and enter Y-return to confirm it.

Busy for a long time, we all tired, let the machine slowly updated, we have a cup of coffee to soak a kung fu tea. There are a lot of things coming up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.