上一章我们实践了如何将Fedora重新打包成ISO,接下来对ISO安装过程进行定制,使用的技术主要是kickstart文件进行管理。
定制化自动安装Kickstart
KS详细配置参数请参考KICKSTART SYNTAX REFERENCE
之前在安装Fedora的时候,一般会在root目录生成一个安装的配置文件anaconda.cfg,这个文件是一个当前系统安装kickstart文件的一个简略版,可以参考一下:
[root@localhost ~]# ls
anaconda-ks.cfg Fedora-Server-dvd-x86_64-31-1.9.iso
先看一下这个文件,我适当的添加关键性注释:
#version=DEVEL ignoredisk --only-use=sda iscsiname iqn.1994-05.com.redhat:46a93490da59 # autopart是自动分区,如果想手动分区,需要注释此行 autopart # Partition clearing information clearpart --none --initlabel # Use graphical install graphical # Use CDROM installation media cdrom # Keyboard layouts keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8 # Network information # 这里是网络配置,如果想在装完系统后再配置网络,可以将此部分注释掉 network --bootproto=dhcp --device=enp0s5 --ipv6=auto --activate network --hostname=localhost.localdomain # Root password # 这个密码是安装此操作系统时的root密码,如果指定这里,root密码会在安装时指定,并在过程中直接跳过 rootpw --iscrypted $6$wdv7q0CXjYg3MVuf$UfUKQuNCLxiAjRNslH59a4QIWl5yqeHYAiD53OxExBYyVvR8Q3phNLLhRGVXYJkvpMGk4yVJQd1YvAD9r5QAH0 # Run the Setup Agent on first boot firstboot --enable # System services services --enabled="chronyd" # System timezone timezone Asia/Shanghai --isUtc %packages # 这里是安装的包 @^server-product-environment # 这里可以增加我们要安装的包 %end %addon com_redhat_kdump --disable --reserve-mb='128' %end %anaconda pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty %end
在我们的需求中,大部分的修改数据就是以上注释的几个部分:
- 分区,我的部署过程一般是将分区部分注释掉的,这样可以让管理员按自己的逻辑进行分区处理
- 网络配置也是一般注释掉的,网络配置由管理员手动配置
- password使用预置的password,这样可以给服务器一个默认的密码,可以使用以下命令生成进行替换:
python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'
- 安装的包一般有两种方式,一种是配置rpm的xml文件,将rpm加入到server-product-environment中,另一种是直接将包放到%packages和%end之间,进行指定安装
- 配置一些包的开启关闭状态(参考下面的文件关闭selinux和firewall)
- 还可以在ks文件最后加入要执行的脚本,例如下例中展示的允许root使用密码登录
以下是我常用的ks文件:
auth --enableshadow --passalgo=sha512 # Use CDROM installation media cdrom #version=DEVEL ignoredisk --only-use=sda # Use graphical install graphical # Use CDROM installation media cdrom # Keyboard layouts keyboard --vckeymap=us --xlayouts='us' # 关闭selinux和firewall selinux --disabled firewall --disabled # System language lang en_US.UTF-8 # Network information #network --bootproto=dhcp --device=enp0s5 --ipv6=auto --activate #network --hostname=localhost.localdomain # Root password rootpw --iscrypted $6$wdv7q0CXjYg3MVuf$UfUKQuNCLxiAjRNslH59a4QIWl5yqeHYAiD53OxExBYyVvR8Q3phNLLhRGVXYJkvpMGk4yVJQd1YvAD9r5QAH1 # Run the Setup Agent on first boot firstboot --enable # System services services --enabled="chronyd" # System timezone timezone Asia/Shanghai --isUtc %packages @^server-product-environment %end %post echo "PermitRootLogin yes" >> /etc/ssh/sshd_config %end
将这个文件保存到ks.cfg,然后放到制作ISO的目录中,我这里是/opt/fedora-custom/isolinux/
然后修改/opt/fedora-custom/isolinux/isolinux.cfg
找到Install Fedora的部分,让操作系统安装的时候使用ks文件安装,修改如下:
menu separator # insert an empty line label linux menu label ^Install Fedora 31 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=CDROM ks=hd:LABEL=CDROM:/isolinux/ks.cfg quiet
修改完成后,重新使用上一章中创建ISO脚本重新打包,就可以验证我们的ks是不是正常了,按之前的设置,不需要设置root密码,之需要对分区进行划分就可以安装Fedora了。
下面来看一下如何定制一个自己程序专属的RPM包:Fedora Server定制化封装ISO(3)-定制RPM包
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary Anallese Forrest Katzir
Appreciate the recommendation. Let me try it out.
Hi, I do believe this is a great blog. I stumbledupon it 😉 I am going to revisit
yet again since i have bookmarked it. Money and freedom is the greatest way to change, may
you be rich and continue to help other people.
Great web site you have got here.. It’s difficult to find good quality
writing like yours these days. I seriously appreciate people like you!
Take care!!
I every time used to read post in news papers but now as I
am a user of net therefore from now I am using net for articles, thanks to web.
Hi there! Do you know if they make any plugins to safeguard against
hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?
Howdy! This post could not be written any better!
Reading through this post reminds me of my good old room mate!
He always kept chatting about this. I will forward
this write-up to him. Pretty sure he will have a good read.
Thank you for sharing!
Howdy! I simply wish to offer you a big thumbs up for the great information you’ve got right here on this post.
I’ll be coming back to your web site for more soon.
If some one needs to be updated with newest technologies afterward he must be pay a quick visit this site
and be up to date everyday.
I like it when people get together and share opinions. Great blog, stick with it! Veriee Connor Amabel
You need to be a part of a contest for one of the finest sites on the internet. I most certainly will highly recommend this website! Glad Bone Zeculon
This content is great! It definitely hits a pain point of a lot of startups and small businesses when they are trying to figure out the best payroll software for their company. After choosing Intuit, having a walk through the intricacies was important and extremely helpful. Elisa Fredrick Hernardo
A round of applause for your blog article. Much thanks again. Cool. Orelia Zeke Kitty
You are absolutely right! In most cases, those who need therapy the most will never seek it out. Jaquith Tristam Alfreda
I believe this internet site has got very great indited written content posts. Florry Clyde Rouvin
whoah this blog is magnificent i love reading your posts. Keep up the great work! You know, many people are searching around for this information, you could help them greatly. Celie Inglebert Fulvi
Definitely believe that which you stated. Your favorite reason appeared to be on the net the simplest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that they plainly do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects , people can take a signal. Will likely be back to get more. Thanks Jennica Dmitri Blessington
This piece of writing is genuinely a fastidious one it assists new the web viewers, who are wishing in favor of blogging. Cammi Alwyn Fogel
This paragraph will help the internet people for creating new blog or even a weblog from start to end. Bobbee Siffre Millhon
Nice read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch as I found it for him smile Thus let me rephrase that: Thanks for lunch! Dorotea Darrell Ame
I every time used to read article in news papers but now as I am a user of web thus from now I am using net for articles, thanks to web. Codi Fax Eveleen
Can I simply say what a relief to seek out somebody who really is aware of what theyre speaking about on the internet. You undoubtedly know the best way to bring a problem to mild and make it important. Extra people need to learn this and perceive this aspect of the story. I cant believe youre not more widespread since you positively have the gift. Leanora Quinn Beatriz
Excellent post! We will be linking to this great content on our website. Keep up the great writing. Jasmin Rurik Ahern
Hey, thanks for the blog. Really thank you! Fantastic. Leesa Ralph Lesley
Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Anjanette August Drisko
As I web-site possessor I believe the content matter here is rattling magnificent , appreciate it for your efforts. You should keep it up forever! Best of luck. Dode Bond Bonnee
Life is short, and this article saved valuable time on this Earth. Teena Yale Edmonda
Like!! Really appreciate you sharing this blog post. Really thank you! Keep writing. Flory Lewiss Land
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?| Orella Ingar Boru
Thanks for expressing your ideas with this blog. In addition, a misconception regarding the finance institutions intentions whenever talking about foreclosure is that the standard bank will not getreceive my installments. There is a specific amount of time the bank will take payments here and there. If you are far too deep inside hole, they are going to commonly require that you pay the actual payment entirely. However, i am not saying that they will have any sort of payments at all. In the event you and the traditional bank can seem to work anything out, your foreclosure practice may end. However, if you continue to miss out on payments in the new strategy, the foreclosure process can just pick up exactly where it was left off. Shayna Alberto Colville
If you want to get much from this piece of writing then you have
to apply such techniques to your won weblog.
These are genuinely fantastic ideas in regarding blogging. Naoma Adler Pelpel
Sweet blog! I found it while browsing on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? Kerianne Svend Sanson
Hello. This post was really interesting, especially because I was investigating for thoughts on this matter last Thursday. Ruthanne Eben Genni
for your blog you might be interested in hearing. Either way, Christal Hugibert Conte
What a joy to find such clear thinking. Thanks for posting! Melany Howey Canica
Really super bro etha slla varthaye ella bro.this feel really feeling nw bri thnx Jermaine Angeli Tremml
I used to be able to find good info from your content. Crysta Rinaldo Natika
Ex eligendi iste sunt et. Repellendus quia praesentium enim beatae sint maxime. Nisi ipsam molestias vel aspernatur quam. Alena Alair Hurlbut
It just keeps getting better, David! Great story and great storytelling! Madel Berkly Damara
Just checking in to show my agreement. Your piece is well structured Nice job! Melosa Lannie Greenland
Heya outstanding website! Does running a blog like this require a great deal of work?
I have no understanding of computer programming but I had been hoping to start my own blog soon. Anyways, if you have any suggestions or techniques
for new blog owners please share. I know this is off topic nevertheless
I just needed to ask. Thank you!
I really like it whenever people get together
and share thoughts. Great blog, continue the good work!
Incredible! This blog looks exactly like my old
one! It’s on a totally different subject but it has pretty much the same layout and design.
Great choice of colors!
You are so awesome! I do not think I have read through anything like this before.
So good to discover someone with some original thoughts on this subject.
Seriously.. thanks for starting this up. This site is something that is needed on the web, someone with a little originality!
What an adorable mini set-up. I love the Holidays and this is just too cute. Plus the hot cocoa and candy canes are perfect! Dee Dee Abba Brena
Hi, I think your blog might be having browser compatibility
issues. When I look at your blog in Chrome, it looks fine but
when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up! Other then that, great blog!
Thanks for sharing your info. I truly appreciate your efforts and I
will be waiting for your further write ups thanks once again.
I was wondering if you ever considered changing the page layout of
your blog? Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so people could connect with it better.
Youve got an awful lot of text for only having
one or 2 images. Maybe you could space it out better?
Marvelous, what a web site it is! This blog presents useful information to us,
keep it up.
Attractive component to content. I just stumbled upon your blog
and in accession capital to say that I get actually enjoyed
account your blog posts. Anyway I will be subscribing for your feeds or even I success you get right of entry to persistently fast.
I believe that is one of the so much significant info for me.
And i am happy reading your article. However wanna observation on few general things, The web site
taste is wonderful, the articles is actually nice : D.
Excellent activity, cheers
For hottest information you have to go to see the web and on internet I found this web page as a most excellent site
for most recent updates.
Hello, everything is going perfectly here and ofcourse every
one is sharing data, that’s in fact excellent, keep up writing.
I love what you guys are up too. This sort of clever work and coverage!
Keep up the awesome works guys I’ve added you guys to our blogroll.
Curabitur tincidunt justo sit amet enim molestie, quis ornare nunc ornare. Nullam tincidunt ex non augue vulputate, non commodo arcu consectetur. Aenean eget sagittis ex, ut blandit neque. Kellsie Ferdie Leta
Needed to post you that bit of word just to say thanks a lot as before about the beautiful advice you have shown in this article. It is quite remarkably open-handed with people like you to provide extensively just what a few individuals could possibly have sold for an electronic book to generate some money for their own end, most notably given that you could have tried it if you decided. The secrets also worked like the great way to fully grasp many people have the identical keenness the same as my personal own to figure out way more with regards to this issue. I am certain there are thousands of more pleasant moments up front for many who scan your blog. Auberta Linus Porush
An interesting conversation deserves comment. I think that you need to write much more on this topic, it could not be a frowned on subject however usually individuals are insufficient to speak on such topics. To the next. Thanks Jonell Nester Etrem
Howdy! This is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a extraordinary job!| Esme Reid Sula
This paragraph is really a nice one it helps new internet visitors, who are wishing in favor of blogging. Kaylil Arlan Boatwright
Pretty! This has been an incredibly wonderful article. Lavena Klaus Janel
I will have to look up both of these authors. I have not read their work before, and am always looking for new authors to read! Thanks for sharing! Natividad Wendel Steinway
Hey there! I know this is kinda off topic but I was wondering which blog platform are you using for this site? Camile West Dyer
Hello mates, its wonderful article on the topic of cultureand completely defined, keep it up all the time.| Reiko Toby Craggie
Good article. I am facing some of these issues as well..
Nice post. I was checking constantly this blog and I am
impressed! Extremely helpful information specially the last part 🙂
I care for such info a lot. I was looking for this particular information for a very long time.
Thank you and good luck.
There is certainly a lot to learn about this issue.
I really like all the points you’ve made.
There’s certainly a great deal to learn about this issue.
I love all of the points you have made.
Good day! I know this is somewhat off topic but I was wondering if you knew where I could find a captcha plugin for my comment form?
I’m using the same blog platform as yours and I’m having difficulty finding one?
Thanks a lot!
I like the valuable info you supply to your articles.
I’ll bookmark your blog and take a look at once more here frequently.
I’m reasonably sure I’ll be told lots of new stuff proper right here!
Good luck for the following!