===== ""OpenSolaris"" Hackery ===== << Please note: to get all the components you'll need (Express, Sun Studio etc) you'll need to register with Sun. It's free, so don't worry too much. << ::c:: {{lastedit show="3"}} Well you see, what had happened was... One day I decided to use some ""OpenSolaris"" on x86 because of some guys I met at ""osCon2006"" at the ""OpenSolaris"" booth. So, I went about trying to get a copy. What happened next is written down here. === __Getting ""OpenSolaris"" for x86 (or otherwise)__ === So, the first question when using a new OS is: "how do I get it, what's the release and install mechanism." I've done this with enough new OS' that I decided to go out and search the web before asking questions. I also know that Sun decided to mess up their versioning. They decided since no more "whole number releases" were ever going to take place they'd release Java 1.5 as Java 5, and you also have similar versioning issues with Solaris itself. So, ""OpenSolaris"" 10 runs Solaris 5.2. In the Solaris world you have to understand something. ""SunOS"" is basically the kernel with a few necessary libs. Solaris is a closed source release, akin to a standard Linux distro. ""OpenSolaris"" is an open source distro with certain binary portions for things they don't have properly licensed (drivers etc). But you don't just go get ""OpenSolaris"". No. Instead, you get Solaris Express! This is Sun's only binary distribution, and it's what you'd use to build your own ""OpenSolaris"" system. It's 6 CDs and the installer is quite fun. I just grabbed Solaris Express build 46 (Express is code-named "Nevada") and installed a standard Workstation configuration. There are "consolodations" you can install later, but I haven't gotten to those yet, so I won't write about them. === __""OpenSolaris"" from a Linux prospective__ === I got rid of ""FreeBSD"" as my primary server OS years ago because of a great deal of clunkiness. I love to use Java, which at the time was a major pain in the ass. I also (as it turns out) love the GNU utilities because of their convenience. In fact, I never realized how much I loved Linux until I tried to use ""OpenSolaris"", which doesn't even come with wget or top. Grep is all wrong, ls has no -G (""FreeBSD"") even!. So, the first thing I did was to make myself feel at home. Apparently my network card installation didn't work, so I used **sys-unconfig**, rebooted my machine and ran it through the installer. I know that this isn't the correct way, but it was the fastest. The second thing I did was set out to find all the utilities I needed (see "packages" section) to make myself feel at home. Lastly there were some term issues (see "term hackery"). Now that I've got it hybridized, I feel much much better. I know this isn't true Unix, but I like silly little utilities, syntax coloring, term coloring and recursive grep. Sue me. Oh yes, lastly root has no /root for a home. Your home? It's probably in /export/home if you did the default partitioning. === __""OpenSolaris"" packages__ === As anyone can tell you, one of the major differences in distros/unices is the package manager. They've all got their own (Yum, RPM, apt-get, portage, ports) and we all love a particular one. I love portage because it's precise and USE flags are awesome. Ports is OK too. apt-get works, but is pretty unspecific and not particularly awesomely documented. RPM is like taking a Model T ford to a drag race. 'Nuff said. ""OpenSolaris"" uses consolodations, which I have no idea how to use yet. They're like appliances or services I'd imagine, but take ~2 gigs to build. I, of course, don't believe I have a compiler anyway. I suspect I'll need a Sun sponsored compiler (Sun One is suggsted). I don't want GCC per se because I have none of the libs. So, in the meantime I've found [[http://www.sunfreeware.com/indexintel10.html]] which provides me with x86 packages. I keep a repository in **/opt/pckg/** (pckg so that nothing else writes to it... convention is pkg) of all my packages, in case I want to remove one. Interestingly enough, if you install one for the wrong arch (say: SPARC), you'll get a weird error saying //Invalid arguments//. Remove the package (pkgrm packagename). Also of use is the notion that packages have an 8 letter identifier, all caps, that have ryhme and reason to them. And they're not the filenames, they're things like SMCirssi (Sun Microsystems package irssi. I'm not sure if Sun is the vendor or what their role is). My current list of packages I borrowed: %% glib-1.2.10-sol10-intel-local pcre-4.5-sol10-intel-local grep-2.5-sol10-intel-local screen-4.0.2-sol10-x86.local gtk+-1.2.10-sol10-intel-local sudo-1.6.8p9-sol10-intel-local libgcc-3.3-sol10-intel-local top-3.6-sol10-x86-local libiconv-1.9.2-sol10-x86-local vim-6.3-sol10-intel-local nano-1.2.5-sol10-x86-local wget-1.10.2-sol10-x86-local ncurses-5.4-sol10-intel-local %% Vim, wget, top, screen are all essential. I like to use a recursive grep, so I got the GNU util. I like sudo, so I grabbed that as well. Nano comes in handy. The rest are mostly support libs (note: I didn't grab GCC, but the lib because I may not want to compile with GCC... not sure yet). I ended up getting Sun Studio 11, which is a package that contains quite a few compiler options (see the full list at the very bottom). You can find it [[http://www.opensolaris.org/os/community/tools/sun_studio_tools/sun_studio_11_tools/ here]], and it requires a login and is over 300mb. === __""OpenSolaris"" term hackery__ === I like Linux's term handling. It has colors, it lets me use my home key to get to the begining of a line. It's not a piece of garbage. It doesn't say wuff---wuff at me. So... I set up my bash profile like so: %%(bash) ## ## Export vars ## export EDITOR=vim export PATH=.:/opt/bin/:/usr/local/bin/:$PATH export ANT_HOME=/export/home/kog/ant/ export TERM=xtermc export MANPATH=/opt/man:$MANPATH ## ## Terminal color on local logins ## source /etc/profile ## ## Bindings ## # home key bind '"\e[1~":beginning-of-line' # del key bind '"\e[3~":delete-char' # end key bind '"\e[4~":end-of-line' # pgup key bind '"\e[5~":history-search-forward' # pgdn key bind '"\e[6~":history-search-backward' %% I like VIM, /usr/local is where all my GNU utils went (I put it first because I prefer to use GNU grep instead of Solaris grep etc). the TERM setting will allow you to use colorized Vim, and will let you run ports like top (which complains if you give it xterm-color because it has no termcap. I could give it one, but I'd have to go hack something together). Ant is an Apache buildtool I use (hey, it's ""OpenSolaris"", it only makes sense to use Java). I also noticed that my term hacks listed work great with SSHD, but not with local terminals. I went ahead and created a symbolic link from ~/.bashrc -> ~/.bash_profile. I set my bash_profile to run source /etc/profile, and now I have my term running how it should. This is, I'm sure, not the approved Sun way, but it sure does work... ... Oh, but it gets better. My term still wasn't colored in. I like my bash to be configured exactly how it is on gentoo: colored, displays CWD and quite nice. So, I stole my /etc/profile from gentoo, as well as my /etc/bash/bashrc. I put them both in their respective directories. I then had to hack my bashrc to get around the fact that Solaris doesn't come with dircolors, so I made the modification that you'll see below. Don't bother with your profile.env, it'll be wrong. **/etc/profile** %%(bash) # /etc/profile: login shell setup # # That this file is used by any Bourne-shell derivative to setup the # environment for login shells. # # Load environment settings from profile.env, which is created by # env-update from the files in /etc/env.d if [ -e /etc/profile.env ] ; then . /etc/profile.env fi # 077 would be more secure, but 022 is generally quite realistic umask 022 # Set up PATH depending on whether we're root or a normal user. # There's no real reason to exclude sbin paths from the normal user, # but it can make tab-completion easier when they aren't in the # user's PATH to pollute the executable namespace. # # It is intentional in the following line to use || instead of -o. # This way the evaluation can be short-circuited and calling whoami is # avoided. if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}" else PATH="/usr/local/bin:/usr/bin:/bin:${PATH}" fi export PATH unset ROOTPATH # Extract the value of EDITOR [ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`" [ -z "$EDITOR" ] && EDITOR="/bin/nano" export EDITOR if [ -n "${BASH_VERSION}" ] ; then # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1 # including color. We leave out color here because not all # terminals support it. if [ -f /etc/bash/bashrc ] ; then # Bash login shells run only /etc/profile # Bash non-login shells run only /etc/bash/bashrc # Since we want to run /etc/bash/bashrc regardless, we source it # from here. It is unfortunate that there is no way to do # this *after* the user's .bash_profile runs (without putting # it in the user's dot-files), but it shouldn't make any # difference. . /etc/bash/bashrc else PS1='\u@\h \w \$ ' fi else # Setup a bland default prompt. Since this prompt should be useable # on color and non-color terminals, as well as shells that don't # understand sequences such as \h, don't put anything special in it. PS1="`whoami`@`uname -n | cut -f1 -d.` \$ " fi for sh in /etc/profile.d/*.sh ; do if [ -r "$sh" ] ; then . "$sh" fi done unset sh %% **/etc/bash/bashrc** %%(bash) # /etc/bash.bashrc: # $Header: /var/cvsroot/gentoo-x86/app-shells/bash/files/bashrc,v 1.6 2005/05/26 22:07:59 vapier Exp $ # # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. # Test for an interactive shell. There is no need to set anything # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now return fi # Bash won't get SIGWINCH if another process is in the foreground. # Enable checkwinsize so that bash will check the terminal size when # it regains control. #65623 # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) shopt -s checkwinsize # Set colorful PS1 only on colorful terminals. # dircolors --print-database uses its own built-in database # instead of using /etc/DIR_COLORS. Try to use the external file # first to take advantage of user additions. use_color=false safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM if [[ -f /etc/DIR_COLORS ]] ; then grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true elif type -p dircolors >/dev/null ; then if dircolors --print-database | grep -q "^TERM ${safe_term}" ; then use_color=true fi fi #Solaris hack! use_color=true #I also had to add the \u@ part down there, because I like to see the username anyway... The color will be red, instead of green. if ${use_color} ; then if [[ ${EUID} == 0 ]] ; then PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' else PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]' fi else if [[ ${EUID} == 0 ]] ; then PS1='\u@\h \W \$ ' else PS1='\u@\h \w \$ ' fi fi %% One weird thing I've noticed is that coming out of Vim, you'll see a 0 in front of your username. After the next command it dissapears. I'll have to look into this, but since it's not colorized it must be some sort of buffer issue. Not quite a term hack, but because I like to have a term show my hostname and not "unknown" I decided to go about the more laborious task of changing /etc/hosts. ~- Edit /etc/hosts and change unknown to your hostname ~- Edit /etc/hostname.interface (ex: hostname.rtls0) and add an entry for yourself ~- as root run hostname newHostName (ex: hostname Sparky) For some reason Gnome cored on giving me new terms after that, but SSH would work. ctl+alt+backspace fixed that right up. == ** SAMBA **== Samba was not pleasant at all. I grabbed the required packages from sunfreeware and unpacked them. I ended up moving the samba.server script to /usr/local/sbin (which is in my $PATH). I ended up creating an smb.conf file in /usr/local/samba, and an smbusers file in /usr/local/samba/lib. I symlinked /usr/local/samba/lib/smb.conf to ../smb.conf because of smbpasswd requiring me to have my conf there. I also ended up symlinking /usr/local/lib/libiconv.so.2 to /lib/libiconv.so.2 because of the dependencies (which I found with ldd, wonderful little tool). Of course, you'll get other failures on libraries, because most of this stuff was compiled to use /lib instead of /usr/local/lib. It's also compiled to use /etc/sfw instead of /usr/local/samba. It wouldn't read my config file, or my password file. So, I symlinked. Now it works. == ** Sun Studio 11 includes:** == %% CC ctc er_src ootags version-5.0 CCadmin ctcr etags ptclean visu amd64 ctrace f77 rcs-checkin visuroot analyzer cxref f90 rtc_patch_area whatdir b2m dbx f95 rxm xdcapture bcheck dem fbe rxs xdconfig bil2xd dmake fdumpmod sbcleanup xdesigner c++filt dumpstabs fpp sbenter xdhelp c89 dwarfdump fpr sbquery xdrecord c99 ellcc fsplit sbtags xdreplay cb er_archive gil2xd smallxd xdroot cc er_cp gnuattach smctl xdtosj cc-5.0 er_export gnuclient ss_attach xemacs cflow er_kernel gnudoit sunstudio xemacs-mule checkjava er_mv gvim tcov collect er_print indent uil2xdMachine hardware: i86pc cscope er_rm lint version OS version: 5.11 Processor type: i386 Hardware: i86pc The following components are installed on your system: Sun Studio 11 Sun Studio 11 C Compiler Sun Studio 11 C++ Compiler Sun Studio 11 Tools.h++ 7.1 Sun Studio 11 C++ Standard 64-bit Class Library Sun Studio 11 Garbage Collector Sun Studio 11 Fortran 95 Sun Studio 11 Debugging Tools (including dbx) Sun Studio 11 IDE Sun Studio 11 Debugger GUI Sun Studio 11 Performance Analyzer (including collect, ...) Sun Studio 11 X-Designer Sun Studio 11 VIM editor Sun Studio 11 XEmacs editor Sun Studio 11 Native Connector Tool Sun Studio 11 Performance Library Sun Studio 11 Building Software (including dmake) Sun Studio 11 Documentation Set version of "/opt/bin//../prod/bin/../../bin/cc": Sun C 5.8 Patch 121016-02 2006/03/31 version of "/opt/bin//../prod/bin/../../bin/CC": Sun C++ 5.8 Patch 121018-02 2006/04/26 version of "/opt/bin//../prod/bin/../../bin/f90": Sun Fortran 95 8.2 Patch 121020-01 2005/11/21 version of "/opt/bin//../prod/bin/../../bin/dbx": Sun Dbx Debugger 7.5 2005/10/13 version of "/opt/bin//../prod/bin/../../bin/analyzer": Sun Performance Analyzer 7.5 2005/10/13 version of "/opt/bin//../prod/bin/../../bin/dmake": Sun Distributed Make 7.7 2005/10/13 %% ---- This page is [[CategoryMiscComputers]]