Creating lightweight Linux servers (1)

Source: Internet
Author: User

I haven't written a Blog for a long time. I don't want to talk about anything when I'm busy. Lazy is the biggest reason. Recently, I was busy creating a website for the lab. In addition to my familiar Web Design & Development, I also set up a Linux server. On the one hand, it is used to place our sites, and on the other hand, it is used to place a server in the lab. It also provides some additional services for the LAB members to facilitate scientific research and learning.

Although I am familiar with Web, I am definitely a beginner in Linux server. Although it has never been used for development, it is basically a matter of calling Apache or PHP. Therefore, the content below is just a record. You are afraid to give an axe to the class, and the methods are also Google. If you have any suggestions, please submit them.

This article only describes how to build a basic server. I chose Ubuntu as the release version. Although I know that CentOS or RHEL may have better performance, it is easy to get familiar with Ubuntu after all. Ubuntu has a Server version and can install a LAMP Server without any intervention. However, the pleasure of Linux is that, I also want to know that everything is running on the server, so I decided to build a clean basic system. After some Googles, I found a nearly "perfect" Tutorial: Minimal Ubuntu 8.04 Server Install. The following installation process is basically based on this tutorial, A slight improvement satisfies the actual needs.

To get started, start installation. First, use Ubuntu 8.04 Desktop Live CD to boot the server and start a Terminal.

Step 1: Start the partitioning tool to partition hard disks. Here I am also using cfdisk without GPart because this server has no mouse at all-_-B) and partitioned the 500 GB hard disk. The command is as follows:

Sudo su

Cfdisk/dev/sda

The 60 MB primary partition is used as/boot, 50 GB logical partition is used as root partition, 4 GB logical partition is used as swap partition, and the remaining one partition is used as/home. Do not forget to write data to the partition table after dividing.

After the partition is complete, start formatting each partition. For convenience, I only use the ext3 format:

Mkfs. ext3/dev/sda1

Mkfs. ext3/dev/sda5

Mkfs. ext3/dev/sda6

Mkswap/dev/sda7

After partitioning, you can install the basic system. here you need to use debootstrap. The specific command is:

Mkdir/min

Mount/dev/sda5/min

Mkdir/min/boot

Mount/dev/sda1/min/boot

Mkdir/min/home

Mount/dev/sda6/min/home

Apt-get install debootstrap

Before executing debootstrap, we recommend that you first set the source. Because this step requires a large number of software downloads, it is necessary to select the fastest source. Here I use the cn99 Source:

Nano/usr/share/debootstrap/scripts/hard

Find default_mirror in the following section, and change it to the source you need:

Case $ ARCH in amd64 | i386 | iSCSI)

Default_mirror http://ubuntu.cn99.com/ubuntu

Then start installing the minimum system

Debootstrap hard/min

After that, we need to set the system to make it available. First, we can copy some settings directly to the target system:

Cp/etc/hosts/min/etc/

Cp/etc/network/interfaces/min/etc/network/

Cp/etc/bash_completion/min/etc/

Cp/etc/bash. bashrc/min/etc/

In addition, we also need to make some settings for the optical drive:

Mkdir-p/min/media/cdrom0

Ln-s cdrom0/min/media/cdrom

Create fstab:

Nano/etc/fstab

The content of the fstab file is roughly as follows:

Proc/proc defaults 0 0

/Dev/sda5/ext3 relatime 0 1

/Dev/sda1/boot ext3 relatime 0 1

/Dev/sda6/home ext3 relatime 0 1

/Dev/sda7 none swap sw 0 0

/Dev/cdrom/media/cdrom0 udf, iso9660 user, noauto, exec, utf8 0 0


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.