Build your own Linux distribution __linux

Source: Internet
Author: User
Tags get ip
Building a Linux distribution of its own is a dream for every free open-source software enthusiast. It was once a very difficult thing to do, a Linux distribution is also rare, can do a Linux distribution has been extremely glorious things. But, by itself, to promote its own potential, To promote their own practical spirit of the free open source world, is not to be expected to the things we are deliberately dressed as far away from the masses of ice and snow beauty, he will continue to reform their own development mechanism, so that everyone gradually participate in their development in the middle, and thus promote their own development.

In short, it's not hard to do a Linux distribution right now.

A basic issue for a Linux distribution.
I think the first thing you need to consider for a Linux distribution is:
1 Why do I need a Linux distribution?
2 Are you going to change it from nothing, or on the basis of other Linux distributions?
3 What is the key and difficulty in making a Linux distribution of your own?
4 Choose which existing Linux distribution to start your own work.

First of all, why do you want a Linux distribution?
The answer to this question is many, the more common one is I want to do, there is no reason, must say the reason, I borrow a fashionable words: Just for fun!, this is a good reason.

And then one important reason: I need a Linux distribution that meets my special needs, like, "I'm learning Perl programming, I need a small one, always follow my Perl compile system, and everything else is OK." Then I need to make a Linux release that supports USB boot, with only the basic system plus the editor and Perl, which I can carry, and I can start my study anytime I have a computer.

As for why I want to do a Linux distribution, the reason is simple: I am a teacher! I think it is necessary to make a Linux distribution that conforms to the education law, education-related software, and more specifically, I am a geography teacher, and now the new curriculum standards keep pace with the times, asking students to learn GIS knowledge, Both mandatory modules and optional modules are required. I don't like it. As soon as we talk about GIS education, our geography educators will say ArcInfo and MapInfo, as if the software that even the rich academic research institutions in China are not willing to pay for is everywhere. In the free Open-source software world , with extremely rich 3S (GIS,GPS,RS) geo-software. As far as GIS software is concerned, there are hundreds of dozens of of them, the famous such as Grass Qgis, these free software is not as good as commercial software in function, But it is enough to satisfy the general GIS teaching for the purpose of understanding basic GIS basic concepts. And the software has its own advantages and strengths. And considering that our current school computer is running Windows This reality, I want to do one of their own, the CD-ROM form to start and run, the main GIS software, Performance and speed are satisfactory Linux distributions.
(Note: Similar systems are now available in the world, including the UNESCO Freeduc, which contains Qgis, but does not yet support Chinese)

The third reason to be a Linux distribution is to be named, some people make a distribution to make money and profit, this does not conflict with free software and GPL copyright, Redhat recent profits to many young people have brought new fantasy, Hope that they can become the next generation of Bill Gates. Others have made their own distributions on the internet to provide free downloads, the more people use the more he will be happy, he only gains his value of the good name and the praise of his own technology.

In short, there are many reasons why we need to build a Linux distribution of our own, especially the vast number of teachers working in the forefront of education!

2 How to start a Linux distribution of your own
And then we're going to solve the second question, do I make a Linux distribution by choosing to do it from scratch or on the basis of someone else's Linux distribution, and make the changes I want with my own will?

In fact, what we call starting from zero is relative. Which zero do you start with? Do you start by writing an OS yourself, or do you start by compiling your own existing Linux kernel?

I guess it's impossible for us to start with a real zero, it is absolutely impossible for a person to complete the work, we should be based on the work of predecessors to start their own work. In terms of making your own Linux distributions, this inheritance of previous work can be divided into two scenarios:

A Linux distribution based on existing Linux kernel and other source code
This is in fact based on LFS (Linux from Scratch) to make its own Linux distribution. Since LFS builds its own Linux distributions from scratch based on the use of source code, Using this method to make your own distribution best enables the author to get a deeper understanding of the relationships between the various software in Linux, and to get a better understanding of some of the operating mechanisms within Linux. But it takes a long time, is relatively difficult, and is suitable for those who are inquisitive about things.
Linux distributions based on LFS appear to be personal, and few of the popular works are known.

B make your own Linux distributions based on existing Linux distributions
In this case, in the existing well-known Linux distributions, choose your favorite Linux distribution and then tailor, add, process, and then make your own Linux distribution.

This way is simple and fast, suitable for the general user or eager to create a finished product of the user. Now the Linux distributions made in this way are Heng and difficult to count, with many of the famous works, and whether one or two will be the next generation of OS overlord.

To quickly and easily achieve your own Linux distribution, we chose to build on our existing Linux distributions to create our own distributions. So, which distribution do we choose as our starting point? Before we answer this question, we will solve the third problem first.

3 What is the key and difficulty in making a Linux distribution of your own?
Where is the key and the difficulty in making your own Linux distribution? Beginners may find it difficult to start a Linux system of their own, which is not. The key to customizing a Linux distribution is to address the relationship between the various packages in the distribution.

Free open source software both uses the source code of predecessors, also to future generations to open their own source code, so, free open source software always use a variety of different software packages, which has brought great convenience to the development, on the other hand, the relationship between the various software packages complex, often to the integration of software has disastrous consequences. For example, you intend to install software a,b and C in your release, while A's operation relies on the A1,A2 and a3,b operations to rely on b2,c, in order to install the software C1, you must install A,B,C, after installation, found that A1 run to use the library A11 and A12,C1 operation needs to use the library C11, and so you Dickens find A11,a12 and C11 source code to compile, installation, only to find that A12 and C11 are conflicting. You cry.

So, I think the key to doing a Linux distribution is to properly resolve the dependencies between the various packages.

4 Choose which existing Linux distribution to start your own work
So which of the existing Linux distributions you choose to start your own job? I think this is going to be a carrot and greens problem, you can choose FC, you can choose Slackware, but from what I've described above, obviously I'm inclined to choose to develop a customized version of the distribution based on Debian. I think the biggest advantage of Debian is its advanced, unique package management, through the world's excellent programmers of the hard work and selfless, a good solution to a variety of free and open source software dependencies between, conflict and other relations, Enabling Debian to install software in one of the most convenient ways in all operating systems is also a great convenience for customizing your own distribution based on Debian development.

Of course, some people may say, FreeBSD package management is also very convenient and powerful, why not choose FreeBSD it. This is because FreeBSD does not comply with the GPL copyright, its own FreeBSD license does not allow the development of personalized distribution based on FreeBSD, so we have only exclaiming.

Now I'm going to customize my distribution based on Debian, and there's a simpler way to develop it. In view of my actual development needs, I just need to develop a demo system for teaching, I'd better make a livecd, that is, the Linux custom system running on the CD, I intend to develop my custom system based on the Knoppix or Morphix system.

Knoppix is a well-known LiveCD system based on Debian, using a number of unique techniques to make it easier to develop on it than on Debian, while Morphix is based on the Knoppix-developed modular LiveCD, viewed from its name, Morphix means deformed Linux, which is made for customizing personalized Linux. It pushes the simplicity of a custom Linux system a step further.

But people are still not satisfied, some people are also developing remaster, development trom, and so on, their goal is: In a graphical interface, click a few mouse, the new custom release version produced. It may not be long before the day comes. Is this exciting news or is it frightening news? At least I feel very nervous, I want to write this article quickly, rush in that kind of software before the completion of this article, otherwise, as long as a few mouse can create their own distribution, who also came to see my article.

Debian-->knoppix-->morphix, custom development based on these three distributions is getting easier, but in my practice, development based on Morphix and simpler trom tools often goes awry, and Knoppix based development is stable, So, I decided to develop a Chinese version of the GIS distribution based on Knoppix.

Two specific development processes.
The following is my specific development process, of course, based on the article on the basis of your worthies, but according to my own understanding, and for the new Knoppix version made some changes. The article is written entirely on a Windows machine, so some details are wrong.

1 Preparation work:
I think the first step in preparing for a job is to see if your computer is strong enough. The best one G memory, two g swap partition, more than ten G hard drive. Of course, 256M memory +1g swap partitions can also work, slower. Hard disk space as large as possible, I began to splurge on customization, unexpectedly get 8G hard disk space. Of course, I write the following process is careful to use hard disk space, in time to remove and uninstall unused space, should have 3-4g hard disk free on it.

Then you will install the Cloop related software. Introducing Cloop I think is the biggest feature of Knoppix, I am using a Debian system, then:
#apt-get Install Cloop-utils
It's OK.

Then is to get the latest version of the Knoppix, the current version is 3.7, but it seems not officially announced, we use the 3.6 version of it, and then assume that I downloaded the Knoppix36.iso bar. I will not carve a plate without affecting the custom work behind it.

Then set up the working directory, I set up in the working directory of a/wen directory, which has established old and new two subdirectories, obviously the former is to store the original content of Knoppix36.iso, and the latter will be stored after my transformation of the content.

2 began to customize the transformation.
First mount the knoppix36.iso image file:
#mount-O loop-t iso9660/root/knoppix36.iso/mnt/cdrom
Obviously I downloaded the Knoppix in the root directory and I mounted it under/mnt/cdrom, and the following two parameters can be modified according to the actual situation.

Now you can go into the/mnt/cdrom to see what is in the Knoppix, there is a boot directory, obviously this also started related to the later you want to modify the splash screen, and so on, we will go to modify the contents of this, we now temporarily ignore these. There is also a Knoppix directory, which has some files underneath it, one of the Knoppix files that are huge to nearly 700M. This is the subject we want to revise.

Below we first copy all the contents under/mnt/cdrom to/wen/new, because we need to modify only Knoppix this file, we will delete, but now also useful:
#cd/mnt/cdrom
# Cp-r */wen/new/
#umount/mnt/cdrom
You can now even delete the Knoppix36.iso file to save hard disk space.
   
Below we want to/wen/new/knoppix/knoppix file operation, this file is 700M, or use cloop compression, so we first unpack:
#cd/wen/new/knoppix/
#extract_compressed_fs KNOPPIX > Tmp.iso
The results of the decompression are placed in the root directory in tmp.iso form. Note that this decompression process is extremely long, I usually boil boiling water, bubble instant noodles, eat slowly, clean the table, decompression finished.
No! is early. Go out to exercise a bit, and so you put the aspects of consumption almost, decompression is basically completed, look at the root directory, frighten you, Tmp.iso unexpectedly will near 2g!
Now be sure to delete the file/wen/new/knoppix/knoppix, because we need to transform tmp.iso to generate a new KNOPPIX file, remember.

Then mount the Tmp.iso and copy all the content to the/wen/old/knoppix below, and you should be quite familiar with it:
#mount-O loop-t iso9660/tmp.iso/mnt/cdrom
#mkdir/wen/old/knoppix
#cd/mnt/cdrom
#cp-R */wen/old/knoppix
#umount/mnt/cdrom
In order to save the hard drive, you can also delete the/tmp.iso now.

The next step is to enter the concrete transformation of the work phase, here is mainly the use of chroot this command and Debian system convenient Apt-get installation, uninstall software, need to pay attention to things:
In order to use the network, you need to mount the proc in the chroot environment, but also pay attention to the CHROOT environment can correctly resolve the domain name. This is the problem I resolved, then open a console window to execute:
#cp/etc/apt/sources.list/wen/old/knoppix/etc/apt/sources.list
#cp/etc/resolv.conf/wen/old/knoppix/etc/resolv.conf
The premise of this is that you have no chroot before your network is unobstructed. Another solution is for me to ping my own sources.list table apt source to get IP, write directly to chroot sources.list file to save the trouble of DNS parsing.
#chroot/wen/old/knoppix/
$ mount-t proc/proc proc

Now that you're in the middle of the old KNOPPIX3.6, you can totally treat it as a normal Debian system and use the usual commands to transform the old system:
$ apt-get Remove OpenOffice.org
$ apt-get Remove KDE-I18N-{ES,DE,FR,IT,NL}
(first remove a few of the large packages I do not use, which can save 300-400m space.) You can use the command dpkg-query-l to see which packages are installed, and then delete them according to your wishes.
$ apt-get Install grass
$ apt-get Install Qgis
(Installed two software I need)

Simple renovation work done, now do a little cleanup work can quit:
$ apt-get Clean
(Delete the packages just downloaded to avoid being included in the new release)
$ updatedb
(Update software database)
$ update-menus
(Update menu)
$ umount proc
Remember )

The following is the use of ctrl-d exit chroot Environment, finally we have to do two things: first, after the transformation of the/wen/old/knoppix to KNOPPIX file and write to the/wen/new/knoppix, and the second is/wen/new/ Make a disc image file. These two steps are to use the Makeisofs command, the system does not have to install the first. Both of these commands are very long, and I usually write them as script files to make it easier to reuse.
#mkisofs-R-u-v "Www.wen.net"-P "www.wen.net"-hide-rr-moved-cache-inodes-no-bak-pad/wen/old/knoppix | Nice-5 create_compressed_fs-65536 >/wen/new/knoppix/knoppix
Note that the above should be written in one line, the compression process requires the time and the previous decompression time as long as the next to eat a bag of instant noodles bar.
The/wen/old directory should not be removed and can be further modified on its basis later.

To make a disc image file: (3.3 is different for version 3.6)
#mkisofs-pad-l-r-j-v-v "Wenppix"-no-emul-boot-boot-load-size 4-boot-info-table-b boot/isolinux/isolinux.bin-c B Oot/isolinux/boot.cat-hide-rr-moved-o/home/ftp/knoppix.iso/wen/new
The penultimate parameter refers to the location of the newly generated ISO and can be adjusted by itself. Perform this command to note the directory location at execution time. Although an absolute path is used, it seems that the command cannot be executed in another directory.

The new release is done, it's simple, but it's hard to do well and we have a lot of details to do:
1 Modify the splash screen and so on
2 Modifying startup scripts
3 It's a time-consuming task to remove a package to make your distribution as small as possible.
4 The distribution of their own transformation usually runs slower than the original, to be optimized.
5 How to install on the hard drive and U disk.
.......

In short, do a distribution, do a good job, maintenance is more difficult.

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.