unix linux administration iii class 1: introduction to solaris 10/11. solaris node configuration....
TRANSCRIPT
Unix Linux Administration III
Class 1: Introduction to Solaris 10/11. Solaris node configuration. Introduction to Perl.
Class details
We will be working primarily with Solaris x86 this quarter.
We will allocate sometime in class for lab work but you should expect some remote work each week to be completed on your “production” build.
Just as we did last quarter, in class we will try to use a local Solaris “development” install.
Agenda Introduction to Solaris 10/11. Solaris 11 node configuration Introduction to Perl
Q3, Class 1, Unit 1
What we are going to cover: Oracle & SUN and Solaris
What you should leave this session with: A little history about SUN and Oracle Basic shell functionality and user
management.
ISO download
Start to download Solaris ISO now:
https://www.ulcert.uw.edu/ISO/sol-11_2-text-x86.iso
Brief history of SUNSun was founded in 1982 by three Stanford graduate students
later joined by Bill Joy. The name SUN came from Stanford University Network. Sun sold proprietary and commodity hardware and much of the revenue stream was tied to this and support.
Later sun focused on multi-threading and multiprocessing which was seen in the Niagara chip sets found in the T series servers.
Sun has had been working with Fujitsu to bring to market a new chip found in the M series servers used for mid to high range servers.
IBM almost acquired by SUN in 2009 but the deal fell through.Oracle stepped up next to purchase SUN, the acquisition was
completed on January 27th, 2010.
Acquisitions of note by SUNCray Business Systems – one of the founding
super computer companies.I-planet – sun web server is based on this
acquisitionStarOffice – answer to MSOfficeNetBeans – Sun IDE based on this acquisitionMySQL – database solutionVirtualBox – alternative to VMware and other
virtualization products.There are of course lots of others these are
just a sampling.
What does Oracle plan to do?According to Larry Ellison Spend more $$ on SPARC than SUN did. Spend more $$ on Solaris than SUN did. Increase sales and support for hardware Provide a complete stack. Think SPARC chips, Solaris,
Oracle, BEA. They will provided certified solutions from end to end.
While lately it has been reported that hardware sales are dropping for Oracle we are still seeing significant effort from them regarding the hardware and software line. Solaris 11 was released 11/9/2011.
Oracle has continued the hardware roadmap and released new hardware since the acquisition.
SPARC and x86 historyEvery release of Solaris 10 since it was introduced in
January 2005 has shipped for SPARC and X86 concurrently. The only difference in the versions is relevant to the CPU instructions.
Sun now also ships a broad line of AMD and Intel powered x86 servers. All of these are certified for Solaris x86
Sun has supported other hardware in the past such as the Power PC (granted for a short time). Solaris has been developed on x86 hardware for a long time and has always been ported to SPARC at completion.
Solaris has had 64 bit support since Solaris 7 circa 95
Solaris user management
Solaris 10 provides a GUI user management tool, Solaris Management Console (SMC) to create accounts. This tool is removed in Solaris 11 and replaced by User Manager panel.
As you would expect there are command line tools for managing user accounts
Solaris user management cont.Solaris also provides access to tools and
functions which closely mimic those found on your Centos and Debian hosts.
/usr/sbin/useradd | userdel | usermod /usr/sbin/groupadd | groupmod | groupdel
Typical syntax to create an account
/usr/sbin/useradd –g <primary group> -G <secondary group> -d /export/home/<userid> -m –s /bin/SHELL –c “Comment” <userid>
Shell initialization filesC, Bourne, Korn and Bash initialization processes
are slightly different.When the bash initialization files are run
commands in /etc/profile are executed first.Next the shell looks for:~/.bash_profile ~/.bash_login ~/.profileThe system reads and executes the commands
from the first file it finds.The –noprofile option may be used when the shell
is started to inhibit this behavior.
Shell initialization continued.
When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if
that file exists. This may be inhibited by using the –norc option. The
--rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.
Default system initialization files
When a new user is added to the system default initialization files are created in the user’s home directory.
These are stored under /etc/skel
Korn, Bourne and Bash all create .profile files based on the contents of local.profile.
Why /export/home/<userid>
Home directories can technically be anywhere; however, on a Solaris system /export/home/<userid> is fairly common/standard.
This is based on the intent to mount the home directory remotely. When AutoFS is running (default) and configured to mount home directories users are NOT permitted to create any directories under /home.
Service Management Facility: SMF
Service Management Facility is a new feature added to Solaris 10 and improved in Solaris 11. replacing traditional startup scripts (init.d)
SMF comes with its own set of tools which include: svcs
svcs –a # lists all services, enabled or disabled
svcadm svcadm disable ssh # disable ssh svcadm enable ssh # enable ssh
We will discuss SMF more later in the quarter.
Review:SUN – Stanford University NetworkOracle – completes the SUN acquisition Jan 27th
2010.Oracle still losing market share with SUN hardware
but delivering new hardware solutions. Solaris 11 released 11/11.Solaris support for x86 extensive.User management similar to LinuxShell initialization reads: .bash_profile .bash_login
and .profile in that order. Non interactive shells read .bashrc by default.SMF is the intended replacement for /etc/init.d scripts.
In class lab 1a
Lab notes for this session can be found here: http://www.ulcert.uw.edu -> Class Content -> InClass labs ->
Q3, Class 1, Unit 2
What we are going to cover: Solaris networking
What you should leave this session with: How to update your network settings Files involved in hostnames values How to start/stop/reboot your server
Network interface configurationTypically a Solaris system will have at least one network interface. During the installation you are guided through initial configuration of this interface. Any other interfaces can be configured manually later.
The two primary configuration options are:Fixed network configuration
Network Configuration Profile (NCP) DefaultFixed
Reactive network configuration NCP Automatic
Reactive network configurationProvides automatic configuration removing the need for manual intervention. This works when moving between wired and wireless networks or if new networks become available. This is primarily envisioned for mobile clients.
NCP Automatic
The Automatic NCP uses DHCP to obtain a basic network configuration (IP address, router, and DNS server) from any of the connected Ethernet interfaces. If this fails, it will try connecting to the best wireless network in the list of known networks.
Enable NCP AutomaticStarting with Solaris 11 ipconfig has been superseded by dladm and ipadm. Updates made using these commands persist reboots and have parse-able output that can be used in scripts.
root@solaris:~# netadm enable -p ncp Automatic
Fixed network configurationThe DefaultFixed NCP disables automatic network configuration. The administrator then has to manually configure the interface using dladm and ipadm. The name services are then managed using Oracle Solaris Service Management Facility (SMF).
root@solaris:~# netadm enable -p ncp DefaultFixed
Fixed network configuration
netadm will display the network connections.
ipadm will display IP address details.
Fixed network configurationCreating a Fixed or static address requires creating an IP interface and an IP address.
root@gsol11-01:#ipadm create-ip net0
And an IP address
root@gsol11-01:# ipadm create-addr –T static –a 172.16.15.98/24 net0/ext
The last argument net0/ext shows the interface name and user set string. Here it could represent external.
Default gateway address.Set the default gateway using the route command
root@gsol11-01:~# route -p add default 172.16.15.2
add net default: gateway 172.16.15.2: entry exists
add persistent net default: gateway 172.16.15.2
root@gsol11-01:~# route -p show
persistent: route add default 172.16.15.2
Name service configuration
Solaris 11 system maintains and manages the name service configuration using SMF.
The SMF service is
svc:/network/dns/client
The file /etc/resolv.conf still exists for backward compatibility but should not be edited directly.
Current Name service configuration
Starting with Solaris 10 SMF service updates are completed using svccfg.
In this example we are printing out the current host name service configuration.
svccfg -s network/dns/client listprop config
Set new nameserver values
The following command will replace the existing nameserver values.
Change the search domainsAgain we use the svccfg command
Once complete refresh (reload) the service. root@gsol11-01:# svcadm refresh svc:/network/dns/client
nsswitch.conf configuration.
Solaris 11 system maintains and manages the nsswitch configuration using SMF.
The SMF service is
svc:/system/name-service/switch
The file /etc/nsswitch.conf still exists for backward compatibility but should not be edited directly.
Updating nsswitch with SMF
We still use svccfg to view and update these values. Multi-value changes may require single quotes around double quotes
Hostname configuraiton
You can check your current hostname using the command by the same name. Alternatively you can use uname –n
Updates should be made using svccfg
Interface names
Unlike Linux Solaris interface names are often hardware related.
hme0, e1000g0, bge0
Often the name first displayed though is the Data link name which often defaults to net0. We can change this to e1000g0 or anything else using dladm however the interface cannot be in use.
How to shut Solaris down/usr/sbin/shutdown –y –g0 –i0-y answer the confirmation question.-g grace period, 0 means now.-i init state to invoke 0 = stop 1 = single user5 = halt6 = rebootAlso available /usr/sbin/shutdown, halt,
reboot and poweroff
Review primary configuration options
fixed network configuration reactive network configuration
reactive networks or Automatic try to use DHCP services. They preferred wired to wireless connections.
Ipconfig has been replaced by dladm and ipadm. Set the default gateway using the route command. configuration updates like the name service, nsswitch,
hostname are managed using SMF Files like /etc/hosts and /etc/resolv.conf exist for
backward compatibility but should not edited directly.
In class lab 1b
Lab notes for this session can be found here: http://www.ulcert.uw.edu -> Class Content -> InClass labs ->
Q3, Class 1, Unit 3
What we are going to cover: Intro to Perl
What you should leave this session with: When to consider Perl over shell How to define a Perl script
History of PERL
PERL: Practical Extraction and Report Language
PERL: Pathologically Eclectic Rubbish Lister
Originally designed and coded by Larry Wall.
Purpose of PERL
Designed to optimally perform common tasks that areToo difficult to create effectively in shell
scriptsToo ephemeral to write in a CSkewed towards reading and processing
large streams of dataRequired to run on a variety of platforms
Design Concepts PERL was written by a linguist, so much of
the syntax works like people speak. Which is to same it can be clear and concise or wordy and confusing.
No built-in limitations to the language Avoid painful distinctions between data
types All variables are considered strings unless a
specific numeric comparison is called for.
Basic Concepts PERL is an Interpreted Language
It is NOT compiled into a binary format Does not require a compiler to operate
PERL Interpreter FeaturesReads the entire program before execution
begins, ensuring syntactic correctnessHas built-in debugging features
Basic Concepts cont. PERL execution has a heavy startup
overheadDon’t use complicated scripts for simple tasksAvoid including unused functionsAvoid repetitiously calling other PERL
programs from inside another PERL Interpreter internally compiles
scripts so execution is rapid once begun
Executing PERL Scripts Take a file of PERL code and pass it to the
interpreter /usr/bin/perl myfile.pl
Make an executable scriptTurn on the execute bit on the file (chmod 755
myfile.pl) Include the location of the interpreter at the
beginning of the file (#!/usr/bin/perl)
Perl directives
very similar in many ways to shell scripting in perl we use a directive such as print followed by an argument. However, in perl each line must end with a semi-colon
print "Hello";
If we want a new line after the output we add \n within the double quotes.
print "Hello\n";
Perl review
Perl is an interpreted langauge like shell.Perl is good at working with large text files
and data sets.Perl has no built in limitiations.Perl tries to make it possible to write perl as
we might speak. Perl requires a semi-colon at the end of
each line.
In class lab 1c
Lab notes for this session can be found here: http://www.ulcert.uw.edu -> Class Content -> InClass labs ->
Homework
If there is time left over I would like you to ensure that your Q1 and Q2 servers are on line are running the required services. I also expect that your Nagios servers are online now.
Production server assignments will be sent out later this week. Homework will be posted later this week also.