Outils pour utilisateurs

Outils du site


issue150:certifie_linux

Ceci est une ancienne révision du document !


Where we are: https://www.lpi.org/ourcertifications/exam-201 -objectives (Topic 202: System Startup). In your LPIC study guide, mine is the second edition, this will be chapter 1 (pages 4 – 27). If you are using the ** free book above, it is chapter 2 (pages 47-76).

Welcome back learners, and a nod to those “just interested”. Since this is the 201 exam, you should be familiar with the FSH (File System Hierarchy) and LSB (Linux Standards Base). You can quickly Google those, I will wait… Right, memory refreshed!

Though we are mostly using Ubuntu here, you need to know the Red Hat side of things too. Init is the first process called during SysV boot. This initial process will now start all the other processes that are listed in the runlevel target. Don’t believe me? Look at the PID of init. If Linux was a first person shooter game, the init process would be the spawn point. The init levels today are still the same 0-6 levels (there are more, but unused) that I encountered back in the day; it has not changed, just know the differences between .deb-based systems and .rpmbased systems. You need to know that in older systems, you can usually see what is defined by printing out ‘/etc/inittab’. At the time of writing this, it is 201 9, and most distributions run on Systemd, so you may get an error with ‘cat /etc/inittab’ if you are following along on a desktop version of Linux. That is OK. Try to run an old version of Fedora or CentOS in a VM to check it out. Be sure to look inside ‘/etc/rc.d’ folder while you are at it. The ‘/etc’-folder is chock full of stuff. See if you can find the rc scripts. (Runlevels 1 through 5). Let us talk about those file names you see. K20xxxxx and S20xxxxx first. Kill scripts range from 01 -99 and so do start scripts. I know you are smart enough to realize the K or S at the beginning means Kill or Start. They are symbolic links. Your homework is to follow them through. If you don’t already know, this will be a light-bulb moment. The number is the sequence in which it starts, so if you see two with the same number, they will start in parallel. Very simple, no? Well, SysV init is simple compared to systemd. That is also why so many people want rc over systemd (and the fact that it is now binary blobs instead of plain text files). To change startup on SysV init should also be simple, right? Stopping, starting, restarting services are as simple as that, you should know that by now. The LPIC study guide glances right over this subject. I really recommend reading the above free study guide. Now an old CentOS system is not the only one you need to start in a VM, I would suggest an old version of Debian or newer Devuan. Otherwise, the next part will be hard for you to follow. You are expected to know, not only the startup process, but how to customise said process. I need you to look at the man pages: man update-rc.d - have a look at the synopsis. You will also see they refer you to the Debian policy manual. You may ask how this worked in the real word. Well let’s say you want to add the printing service to a runlevel, say CUPS. The service you want to start has to be in: /etc/init.d – you cannot just add a service that does not exist. So the syntax would be: update-rc.d <service name> start <sequence number> <runlevel(s)> . stop <sequence number> <runlevel(s) WOW, that looks horrible, but in practise it is something like this: “update-rc.d cups start 58 5 . stop 58 0 6 .“ Note the delimiters - period after start and period after stop. You may get a warning message when changing a service (if it is not the default). To remove a service, the syntax is simply: update-rc.d <service name> remove Regardless if a service ‘usually’ runs in say, only runlevel 5, you can manually start it from /etc/init.d Back to our Red Hat-based system. Here we use chkconfig. Starting on page 58 in the free study guide, I need you to read it. If you did your homework… and followed the links all the way through… you will know where this is heading. If you looked inside the scripts you may have noticed that right near the top, there is a “chkconfig : “ followed by a number. These are your runlevels. So if you saw “345” following chkconfig, it was not the number three hundred and forty five, but runlevels 3,4,5. Now you can remove or add a runlevel here, but think it through thoroughly before doing so. Let’s say we would like to add cron to another runlevel (example only); then we would add say a two to the list , so it reads “2345” and save the file. This alone does nothing. To ‘pull the changes through, so to speak, in the rc.d folders you need to say the magic phrase in the terminal: chkconfig - -add cron To see what changes were made, navigate to /etc/rc.d/rc2.d/ and you should see cron – in our case – has been created. Since the chkconfig was preceded by an octothorpe – it is a comment, but chkconfig read the comments! Neat hey! This is not the only thing chkconfig can do, it is handy beyond this when it comes to services. Linux firewalls work on services, yes, I know, we need a decent application firewall program in Linux, but we do not have any. So a quick way to see which services are on, for firewall configuration, type: chkconfig - - list That said, if you edited cron to run in runlevel 2, you should see “on” in the column that represents runlevel 2. This holds true for any changes you may make – double check it here. If you turn a service on or off with chkconfig, immediately check with the: - - list option. If you want a more finegrained control, you can use the - - level 2 on / off option. Example: chkconfig cron - - level 3 off Just be aware of the differences in systems syntax between Debian-based and Red Hat-based distributions. No practice exam questions this month, I just want you to physically do it in a Red Hat-based VM and see how it is done. Keep your peepers peeled in the exam for questions that specify RED HAT. If you would like to jump ahead, or test your skills at an LPI exam, do a test paper here: https://www.itexams.com/exam/1 1 7-201 (these were once valid LPI questions and will ease you into the format): • The new exam number is 201 -400, 1 1 7-201 was the old one. • The site does require signing up, but sign up with temporary email, not your real email. • DO NOT learn these questions parrot fashion, as they are probably not real exam questions. Let us know how you did; good or bad, it does not matter. Good means you are ready to write and confident in your skills. Bad means you will be learning new stuff!! Yay! There is no downside here. If you do not know why an answer is the way it is, contact us.

issue150/certifie_linux.1572432345.txt.gz · Dernière modification : 2019/10/30 11:45 de auntiee