Basic Service & Settings pmli. Basic Service e.g. http, ftp, etc.
-
Upload
judith-higgins -
Category
Documents
-
view
216 -
download
4
Transcript of Basic Service & Settings pmli. Basic Service e.g. http, ftp, etc.
Basic Service & SettingsBasic Service & Settings
pmli
Basic ServiceBasic Service
e.g. http, ftp, etc.
Com
pu
ter C
en
ter, C
S, N
CTU
3
Most Common FlowMost Common Flow
1. Install Package, ports and tar-ball
2. Configuration Program specified config file rc.conf
3. Startup
4. Maintenance
after installation of a service
rc.conf: used for booting process
Com
pu
ter C
en
ter, C
S, N
CTU
4
Configuration Files (1/3)Configuration Files (1/3)
Local-installed programs’ configuration files can be found in /usr/local/etc• Daemon → program-name.conf
dhcpd.conf
• user-program → program-namerc wgetrc tinrc
Default config file usually installed with .sample or .default suffix• dhcpd.conf.sample
or different suffix for different purpose• php.ini-dist• php.ini-recommended
copy before use it
We got sample files accompanied!
Location of filesAnd naming convention
Com
pu
ter C
en
ter, C
S, N
CTU
5
Configuration Files (2/3)Configuration Files (2/3)
A program with many config files are usually located in /usr/local/etc/program-name/ • apach22
• postfix
Most config files have clear comment at the beginning or before each description
Most popular styles• name <space>value
• name = value
Read documents to know each option’s meaning
Example: proftpd.conf
# Port 21 is the standard FTP port.Port 21
# To prevent DoS attacks, set the maximum # number of child processes to 30. …..MaxInstances 30
Put into dir. if more than one file
Configuration files with comments inside and consistent naming convention
Com
pu
ter C
en
ter, C
S, N
CTU
6
Configuration Files (3/3)Configuration Files (3/3)
Some with local effectiveness• Markup language-like
<directory /path>setting-for-this-path…</direction>
• Samba 、 rsync
[xxxx]
settings…
[yyyy]
settings….
Settings for specific conditions…
RC ScriptRC Script
Scripts for starting/stopping a service
Com
pu
ter C
en
ter, C
S, N
CTU
8
RC ScriptRC Scriptstart
/etc/rc.d/*
/usr/local/etc/rc.d/*
Sort by rcorder
samba
rsyncd
proftpd
mysql-server
lighttpd
……
include /etc/rc.subr
end
Dependency between each service is described in header of the scriptRcorder is used to find out dependency ordering of each scriptEach rc script define what to do when start/stop …/etc/rc.subr defines what to do & check before/after start stop ….
Automatically starting and… Dependency!!Dependency!!Dependency!!
Com
pu
ter C
en
ter, C
S, N
CTU
9
How to use rc script(1/2)How to use rc script(1/2)
Example ntpd>/etc/rc.d/ntpd
Usage: /etc/rc.d/ntpd [fast|force|one](start|stop|restart|rcvar|status|poll)
After booting… (rc.conf)• Pidfile: Record (master) process id of the service
Start / Stop / Restart (Start after stop)
Rcvar• Display which rc.conf variable are used to control the startup of service• Ex: ntpd_enable=“YES”
Usage of RC script on a service:Take ntpd as an example
Display settings in rc.conf– you can’t start a service without setting Enable to “YES”
Com
pu
ter C
en
ter, C
S, N
CTU
10
How to use rc script(2/2)How to use rc script(2/2)
Status• Check the service is running or not
Reload• Reload configuration file if the service support
[One | fast | force]• One
set rcvar = yes Start the service even if XXXX_enable=NO
• Force Set rcvar = yes and
• Fast Skip pid check
Force a service to run…(skip rc.conf check)(skip pid check)
Com
pu
ter C
en
ter, C
S, N
CTU
11
Local installed serviceLocal installed service
After install a service by ports, ports will display• This port has installed the following startup scripts which may cause• these network services to be started at boot time.• /usr/local/etc/rc.d/pure-ftpd
Use path-to-rcscript rcvar command to know which variable should set to “YES” to enable this service
For further information, read comments from that script• # Add the following lines to /etc/rc.conf to enable pure-ftpd:• #• # pureftpd_enable="YES"• #• # For launch uploadscript daemon define• # pureftpd_upload_enable="YES"• # pureftpd_uploadscript="/full/path/to/launch_script"