************************************************* * Document: various_tips.txt * Author..: Stuart Winter with bits grabbed from * usenet and other sources. * Purpose : Remind me how to use Solaris ************************************************* (Almost) required SunFreeware packages --------------------------------------- gzip zip less bash nano ncftp wget zlib openssl openssh gcc-3 (if not v3 then we also need the libgcc library) make ncurses autoconf automake binutils fileutils bzip2 findutils grep prngd (a randomness socket thingy required for SunFreeware OpenSSH) old shell: /sbin/sh Useful commands ---------------- prstat (top) psrinfo sysdef prtconf devinfo praudit /usr/platform/`uname -i`/sbin/prtdiag Make changes to /etc/default/ Make changes to /etc/default/login - make SYSLOG=YES SYSLOG_FAILED_LOGINS=0 comment out CONSOLE=/dev/console Make /usr/local/etc/sshd_config print the motd Make the changes to /etc/profile so it checks SSH_CLIENT and prints the motd if it's not set. Also add -bash to the list of -sh | -ksh etc etc SUNWman pages on the second Solaris 8 CD Getting GCC to work after installation of OS -------------------------------------------- Needed: SUNWColinc SUNWarc SUNWdfbh SUNWhea SUNWlibm SUNWlibms SUNWsra SUNWsrh SUNWtoo SUNWxglh SUNWxwinc SUNwbtool SUNwsprot some aren't needed cos they're X libs http://groups.google.com/groups?q=compile+problems+solaris+faq+packages&hl=en&rnum=3&selm=35B5F7B4.89BDCA8E%40ehpt.com Paths will also need to be set to /opt/ucb etc etc 6.2) Which packages do I need to install to support a C compiler? Solaris ships with everything you need, with the exception of the compiler itself. Solaris ships with the include files, make, an assembler, linker and libraries. All this stuff lives in /usr/ccs/bin (add it to your PATH before /usr/ucb if that's in your PATH as well) /usr/ccs/lib and /usr/include. If you still can't find it, make sure you have the following packages installed on your system: for tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool, SUNWsprot, SUNWtoo for libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms SUNWdfbh, SUNWcg6h, SUNWxwinc, SUNWolinc, SUNWxglh for 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux, SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx for ucb compat: SUNWsra, SUNWsrh These packages are all on the Solaris 2.x CDs, except that some packages may only exist in some releases and not in others. Some packages may be on separate CDs, such as the "Desktop/CDE" CD, but all are part of the Solaris "bundle". Package stuff -------------- Install a package into another dir rather than installing it properly (useful for getting binaries onto other Suns with a busted package manager) pkgadd -d packagefile -s /tmp/dir ldconfig type thing ---------------------- crle -c /var/ld/ld.config -l /usr/lib:/usr/lib/secure:/usr/local/lib:/usr/local/ssl/lib Make SSH keys -------------- ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N '' ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N '' ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N '' Making it work on the network ------------------------------ /etc/defaultrouter contains the default gateway IP /etc/hostname.le0 contains the hostname of the IP to bind to the interface /etc/hosts contains a normal host to IP mapping hostname.le0 looks up the IP from hosts. Patches --------- ftp://sunsolve1.sun.com/pub/patches/ patchadd dirname Useful commands ---------------- ndd -get /dev/ip ip_forwarding Changing timeout for TIME_WAIT sockets ---------------------------------------- ndd -set /dev/tcp tcp_close_wait_interval 20000 where 20000 is msecs = 20 secs... Rebooting ---------- uadmin 2 0 ( u will get ok prompt) or use uadmin 2 1 ( the server will reboot) but that doesn't shut down cleanly Enabling logging on UFS partitions ---------------------------------- /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no logging /dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 /usr ufs 1 no logging mount -o remount,logging / Copying a disk to another -------------------------- If your new disk is similarly partitioned to the original it is quite simple. The following is from memory so it might be wise to check it first. As noted above, the quieter the filesystems are the less risk involved. Under no circumstances should anyone other than root (you) be logged on. If it doesn't rely on a NIS or similar server to operate normally, then disconnect from any network and plug into something like a mini-hub on its own. do a newfs on each partition of the new disk. Then for root filesystem mount /dev/rdsk/c0t?d0s0 /mnt ufsdump 0f - / |(cd /mnt; ufsrestore xf -) rm /mnt/restoresymtable umount /mnt installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t?d0s0 <- your new disk. That should be the root partition sorted. You will need to repeat for each other partition on the disk (except the installboot which is just on the root partition) except swap. When complete remove old disk, change new disk SCSI ID to match old disk. All should then operate OK. I have never failed in this operation, but as suggested earlier there is a certain amount of risk involved in dumping a live filesystem. ------ OR -------- If the new disk is identical in size to the old one, and the old one still works, you can do something like: dd if=/dev/rdsk/c0t3d0s2 of=/dev/rdsk/c0t1d0s2 bs=512k for a full copy of the disk. 'if' is the source, 'of' is the destination, and don't forget to specify a large blocksize, because without it, it takes forever. Display file descriptors for a process --------------------------------------- $ ps -fu dragan | grep bash dragan 5555 5547 0 08:32:28 pts/1 0:00 /usr/local/bin/bash $ /usr/proc/bin/pfiles 5555 Finding files less than 100MB ------------------------------ To find files between 100000 and 200000: find . -type f -size +100000c -size -200000c Mount CD -------- mount -F hsfs -o -ro /dev/dsk/c0t6d0s0 /cdrom/ iso9660 NFS shares ---------- /etc/dfs/dfstab Add this into it: share -F nfs -o rw=@192.168.1.0/24,root=@192.168.1.0/24 -d "/export/home" /export/home bash-2.05# share - /export/home rw=@192.168.1.0/24,root=@192.168.1.0/24 "/export/home" bash-2.05# /etc/init.d/nfs.server start Solaris 9 & /etc/resolv.conf ---------------------------- Solaris 9 does not have an /etc/resolv.conf by default cat << EOF > /etc/resolv.conf domain polplex.org.uk search polplex.org.uk nameserver 192.168.1.1 EOF touch /etc/nsswitch.conf Amount of RAM ------------- prtconf | head -3 |grep Mem Installing KDE for Solaris 9 ---------------------------- You need to sign up to the Sun Freeware page at www.sun.com Download the SPARC Software Companion CD. I installed everything. http://www.sun.com/bigadmin/content/submitted/kde_on_sun.html Forget what it says about LD_LIBRARY_PATH: # crle -c /var/ld/ld.config -l /usr/lib:/usr/lib/secure:/opt/sfw/kde/lib