Launching Linux

Linux offers many services or servers, they can start or boot along with system load can then be put to work when required (is best). An essential part of Linux system administration is continuously working with the services it provides, which is quite simple. In this tutorial you will learn everything you need on how INICA / stopping / resetting, etc.. computer services your GNU / Linux. Starting services manually, init.d directory Inside this folder is located in / etc or / etc / rc.d depending on the distribucción, encuntran a series of scripts that allow INICA / stop the vast majority of services / servers that are installed on your computer. These scripts are scheduled so that the majority recognizes the following arguments: start stop restart status The arguments are self, and have permissions ejecucción, then as root is possible to start a service in the following manner, for example samba: #> / Etc / rc.d / init.d / smb start Starting Samba SMB daemon [OK] Only needs to change start by stop | restart | status to stop, restart (reread configuration files) or check their status. Now if you are standing inside the directory can do so. #> Pwd / Etc / rc.d / init.d #>. / Smb stop Shutting down Samba SMB daemon [OK] This is just a script so with the permission of ejecucción (x) can run with. / Followed by the name of the service, no spaces and then the argument you need, inicarlo, stop etc.. The command service In several distros, like Fedora or RedHat, the command service exists, this command also start and / or stop services actually works exactly as if we write the full path did the init.d directory with the indicated service follows: #> Service mysql status Checking for service MySQL: stopped If you want to start: #> Service mysql start Starting service MySQL [OK] Starting services from the system start In many cases it is desirable that a server or service start alongside computer boot itself, for example the Apache web server or a database, this is to be available all the time and does not require administrator intervention start them. In Linux, unlike other operating systems, can be configured based on ejecucción levels (run levels), each ejecucción level (in most distros are 7) starts and stops (Start or Kill) certain services. These levels are as follows: 0 Stop or shut down the system 1 Single-user mode, generally used for system maintenance 2 multiuser mode, but no network support 3 Full multiuser mode with network services 4 Not used, can be used for a custom home 5 Full multiuser mode with graphical login (X Window) 6 Restart mode (reset) For example, level 0, which turns off the computer, kills or stops all system processes, all services, so does the 6 with the difference that then starts a script that allows reboot. The default level or this definifo system default in / etc / inittab in the line initdefault: $> Grep initdefault / etc / inittab id: 5: initdefault: # Runlevel 0 is System halt (Do not use this for initdefault!) # Runlevel 6 is System reboot (Do not use this for initdefault!) The output is a 10 OpenSuse distro. As you can see there is a line that begins with id, followed by 5 would indicate then the system default level, just change this value with any editor, restart the computer and come to another level, such as 3 having Full functionality without X Window system (ideal for obsolete equipment or hardware with limited resources). Note that in the previous list are two lines of comments that start with #, which makes the warning never to use levels 0 and 6 initdefault, and tear the team ever. They would have to use a rescue method. (Here is the importance of never leaving a deserted terminal with root session open as a prankster and could quickly change the line initdefault to 6 for example, and then be very funny seeing a poor novice case manager to explain why the hell equipped resets the infinitely without ever entering a login screen). The current ejecucción level system can be consulted with who-r runlevel command, the latter shows two numbers the first is the level prior to that was and the second current level, if you have not changed from level appears N. Init Command This command allows you to change the level of current ejecucción other, ie can be at level 3 and at any time pass to 5 or vice versa, or enter single user mode for maintenance and use fsck. This will need to change the initdefault line in / etc / inittab, by simply using the init command: #> Init 3 You can reboot with init 6 or shutdown with init 0, shutdown and indeed other commands like halt, what they do is invoke shutdown init for other tasks like synchronize more buffers, etc.. If you are on a machine that has partitions with ext2 filesystems like FAT or windows, if you call init 0 or init 6 as is, you run the risk of losing data not saved to disk yet, for it combines the init 0 sync command that writes this in memory buffers to disk: #> Sync, sync, init 0 With a dual sync we make sure that everything is written to disk before you start off. The rc directories Under / etc directory is located rc.d which in turn contains a directory for each ejecucción level, so we rc0.d, rc1.d, rc2.d, rc3.d, etc.. There are some distros that these directories are located directly in / etc. As you can imagine, each of these directories contain scripts (or rather links to scripts) that point to the init.d directory, then the init command (executed either manually or when you start the system), depending on the level indicated will read each of the links or shortcuts respective directory. Now, an example (partial) typical of these directories can be the following, taken from rc3.d lrwxrwxrwx 1 root root K22dbus October 7, 20 20:05 -> .. / init.d / dbus lrwxrwxrwx 1 root root K22resmgr October 9, 20 20:05 -> .. / init.d / resmgr lrwxrwxrwx 1 root root K24fbset October 8, 20 20:05 -> .. / init.d / fbset lrwxrwxrwx 1 root root K24random October 9, 20 20:05 -> .. / init.d / random lrwxrwxrwx 1 root root S01fbset October 8, 20 18:23 -> .. / init.d / fbset lrwxrwxrwx 1 root root S01random October 9, 20 18:22 -> .. / init.d / random lrwxrwxrwx 1 root root S03dbus October 7, 20 18:29 -> .. / init.d / dbus lrwxrwxrwx 1 root root S03resmgr October 9, 20 18:23 -> .. / init.d / resmgr lrwxrwxrwx 1 root root 12 October 20 18:24 S04boot.udev -> .. / init.d / boot.udev lrwxrwxrwx 1 root root 10 October 20 21:16 S05network -> .. / init.d / network lrwxrwxrwx 1 root root S06syslog October 9, 20 18:23 -> .. / init.d / syslog Note that all are links init.d directory which as previously saw is really where are located the startup scripts for services or servers. Also, all the links begin with K (kill) or S (start), it is easy to deduce that beginning with K are scripts that receive and stop argument S beginning with the start of, ie start . This great simplicity offers an enormous power when configuring services because you can just add or remove links, formatted according to levels ejecucción customize to our liking. After the K or S is a consecutive number, followed by the name of the service generally affecting the sequence number is simply the order in which the scripts will be read, first starting with K 01 and it forward and then S. So if for example we do not want to start the samba at level 3 would be enough to wipe your link in this directory: #> Pwd / Etc/rc.d/rc3.d #> Rm S54smb And presto, the samba server and not start when we enter this level of ejecucción. If on the contrary we wish to start (or off) a service, just create your link in the respective directory: #> Pwd / Etc/rc.d/rc5.d #> Ln-s / etc / rc.d / init.d / mysql S90mysql #> Ls-l S90mysql lrwxrwxrwx 1 root root S90mysql October 9, 20 18:23 -> .. / init.d / mysql With this the next time you start your computer or change init level 5 with will also start the server from the MySQL database. The number 90 is chosen randomly between 01 and 99 is simply the order they will be started or stopped services. Chkconfig This can be cumbersome for more than one but is the only way if you do not have graphical tools or command line to configure the services more nimbly and precisely one of these tools is chkconfig command line to configure which services start up / stop at every level ejecucción. Clarification: chkconfig not start or stop services at the time (except those under xinetd), creates or deletes only just links that were discussed in the previous section in a more friendly. If what you want is to start or stop the service in real time or manually must use the script or direct service with convenient argument as explained above. Consider examples showing how to work with chkconfig. With the – list gives a complete list of all installed services for each level if you start (on) to get to that level or stopped (off) or just does not start. Note that at the end of the list are the services covered by the xinetd super-server. #> Chkconfig – list apache2 0: off 1: off 2: off 3: off 4: off 5: off 6: off bluetooth 0: off 1: off 2: off 3: off 4: off 5: off 6: off cron 0: off 1: off 2: on 3: on 4: off 5: on 6: off cups 0: off 1: off 2: on 3: on 4: off 5: on 6: off dhcpd 0: off 1: off 2: off 3: off 4: off 5: off 6: off ldap 0: off 1: off 2: off 3: off 4: off 5: off 6: off mysql 0: off 1: off 2: off 3: off 4: off 5: off 6: off named 0: off 1: off 2: off 3: off 4: off 5: off 6: off network 0: off 1: off 2: on 3: on 4: off 5: on 6: off nfs 0: off 1: off 2: off 3: on 4: off 5: on 6: off quotad 0: off 1: off 2: off 3: off 4: off 5: off 6: off smb 0: off 1: off 2: off 3: on 4: off 5: on 6: off vmware 0: off 1: off 2: on 3: on 4: off 5: on 6: off xinetd 0: off 1: off 2: off 3: on 4: off 5: on 6: off zebra 0: off 1: off 2: off 3: off 4: off 5: off 6: off xinetd based services: rsync: off sane-port: off servers: off services: off swat: on systat: off tftp: off time: off time-udp: off vnc: off vsftpd: off If given as an argument the name of a service we return your status: #> Chkconfig smb smb on Without any arguments will give us a list with the status of all services: #> Chkconfig httpd off mysql on smb on They want the apache web server (httpd) start when you enter the level 5, then use the – level: #> Chkconfig – level 5 httpd on The MySQL database is not desired to start at levels 3 and 5, only until the administrator decides to start it: #> Chkconfig – level 35 mysql off Environments graphics In all their current distribucciones X Window graphical environments include configuration tools that can greatly facilitate services server management. In one screen can change ejecucción levels, with a click to indicate whether the service starts or stops, start or stop even then, all via chart. It’s best to learn to do it from the command line as this will be very similar in almost all distros or it may be that you are using linux has no graphic services, still, already familiar with distribucción is very simple and intuitive use these graphical tools so you do not go into details, just say that for example in SuSE yast or yast2 control is possible not only services but many more things in we redhat redhat-config-services and even fedora and enterprise versions redhat is system-config-services, mandrake, ubuntu, etc.. All have a graphical interface, it is just a matter of looking.

On the other hand we have the excellent web interfaces webmin tool, which also allows full control over the management of servers, most effective when servers are controlled remotely via the web.

Fly with Linux 😃😃👍

20131110-212500.jpg

20131110-213440.jpg

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s