Create a customized LINUX

Source: Internet
Author: User
Tags network function
Article Title: Create a customized LINUX. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

LFS Problems

LFS is short for Linux From Scratch. An important reason for LFS is to help people learn how the linux system works. Building an LFS system will help demonstrate what makes linux run and how various components work together. One of the best things is that you can use this kind of learning to get the ability to customize a linux System Based on your needs.

A key benefit of LFS is that it gives users more control over the system, rather than relying on others' linux implementations. In the LFS world, you sit in the driver's position and control every detail of the system, such as Directory layout and startup script configuration. You can also control where, why, and how to install each program. For information about LFS, go to this link to find. http://www.linuxfromscratch.org /.

The environment in this article is set up in VM5.5, where the memory allocated to the virtual machine is 256 MB and the hard disk size is 8 GB. Of course, after the actual completion, the system size is less than 600 mb, however, at least 3 GB of space is required during compilation. For ease of use, the software package can go to the LFS project to download the ready-made ISO package, address for the http://kerrek.linuxfromscratch.org/pub/lfs-livecd/ lfslivecd-x86-6.3-r2130.iso, of course, if you want to use the updated software, please go to the appropriate site to download. The lfslivecd-x86-6.3-r2130.iso is used here.

The production process is long and may last for several days. If the VM is used, you can use its pause function to protect the site and start the production process at the time.

Note: The commands that appear here are all mandatory commands, different from the previous article style.

I. initialize the production environment.

There is a problem when using VM. It cannot be installed and created by copying and pasting commands from files saved on the physical machine, LFS has many compilation commands or other commands, which are similar to each other. For the sake of convenience, enable the network function and use the remote connection tool (Putty, SshClient) to perform command operations.

Start with a CD, as shown in when setting the system time and region:

1: The system starts to user mode. Enter the following command to enable the network function and set the administrator password. Note: When setting a vmvm, use the "bridge" Mode in Nic settings. Otherwise, the IP address may not be obtained, and the IP address can be obtained through DHCP in the LAN.

[Root ~] #/Etc/rc. d/init. d/sshd start
[Root ~] #Passwd root


2: connect to the host through SshClient, and perform partitioning operations on the hard disk. Here, you can perform Partitioning Based on your own needs. Here, I configure a root partition and a swap partition as an example, the swap partition occupies 512 M, and the rest are allocated to the root partition./dev/hda1 is the swap partition, And/dev/hda2 is the root directory of the target system.

Cfdisk/dev/hda

Save and exit before formatting Disk Partitions

Mkswap/dev/hda1
Mkfs. ext3/dev/hda2

3: create a file and path. Here it should be noted that the important directory under the two LiveCD/usr/share/LFS-BOOK-6.3-HTML directory is stored in the LFS manual; /lfs-sources stores the source code package required for the construction of LFS and does not require software everywhere. For more information about the role of commands, see the relevant documentation. The created symbolic link keeps the tool chain to be compiled /ToolsDirectory, which means that the compiler, assembler, and connector can always be used when the target directory is/tools.

Export LFS =/mnt/lfs
Mkdir-pv $ LFS
Mount/dev/hda2 $ LFS
Mkdir-v $ LFS/sources
Chmod-v a + wt $ LFS/sources
Chmod-v a + wt $ LFS/sources
Ln-sv/mnt/lfs/tools //

When you log on as a root user, an error is enough to damage or even destroy the system. Therefore, we recommend that you use an unprivileged user to compile and install software packages. You can use your own user name. However, to create a clean working environment, we recommend that you create a group named lfs and add a user named lfs to it, we will use this user during the installation process.

Groupadd lfs
Useradd-s/bin/bash-g lfs-m-k/dev/null lfs
Passwd lfs
Chown-v lfs/mnt/lfs/tools/
Chown-v lfs/mnt/lfs/sources/
Su-lfs

When logging on as an lfs user, the initial shell is usually a login shell (login shell ), it will first read the/etc/profile file of the host system (may contain some settings and environment variables), and then continue to read. bash_profile file to complete login initialization .. The exec env-I.../bin/bash command in the bash_profile file replaces the current environment with a completely empty environment (except for inheriting the HOME, TERM, and PS1 variables ). This ensures that our compilation environment is not affected by unnecessary or potentially dangerous environment variables in the host system, thus ensuring a clean working environment.

Cat> ~ /. Bash_profile <"EOF"
Exec env-I HOME = $ HOME TERM = $ TERM PS1 = '\ u: \ w \ $'/bin/bash
EOF
Cat> ~ /. Bashrc <"EOF"
Set + h
Umask 022
LFS =/mnt/lfs
LC_ALL = POSIX
PATH =/tools/bin:/usr/bin
Export LFS LC_ALL PATH
EOF
Source ~ /. Bash_profile
Export
Cd/mnt/lfs/sources/

[1] [2] [3] [4] Next page

Related Article

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.