Skip to content

Instantly share code, notes, and snippets.

@fearful-symmetry
Created July 14, 2020 14:52
Show Gist options
  • Save fearful-symmetry/2ed7b56e3cb13a1ee9c96cc817d08f0f to your computer and use it in GitHub Desktop.
Save fearful-symmetry/2ed7b56e3cb13a1ee9c96cc817d08f0f to your computer and use it in GitHub Desktop.
AIX Getting Started

Gettting Started

  • AIX uses RPM and yum.
  • default shell is ksh.
  • Before you start, run df -m to make sure you have enough disk space to do development. Ask for someone who knows IBM's cloud UI to fix it, lest you be forced to wrangle with AIX's volume manager.
  • vim, git and golang available via yum.
  • Dev Toolbox: https://www.ibm.com/support/pages/node/883796. Installing this might help a few things. There's a yum.sh script at the top of the page.
  • Once you install the Dev Toolbox, yum will have an AIX_toolbox repo that contains standard GNU coreutils. The ones you get are not standard. For example, ls --color=auto doesn't work out of the box.
  • Run yum install coreutils once you have the AIX_toolbox repo. Add export PATH=/usr/linux/bin:opt/freeware/bin:$PATH to your .bashrc to get standard gnu coreutils.

User administration

  • useradd will create a new user
  • mkdir /home/USER and chmod USER:system /home/USER to create your directory
  • If you've installed bash 5, it's not available in the default shells available to chsh. You'll need to add /usr/bin/bash to /etc/security/login.cfg. After that, you can run chsh USER /usr/bin/bash
  • If you're a zsh user and you'd like to help me figure out why zsh dumps core all the time, go ahead.
  • At the bottom of this readme I've made a nice ~/.bashrc file since you don't get anything
  • You might need to manually run source .bashrc for reasons I'm not too clear on.
  • If you need to install OpenSSL for something, you'll need to follow the process here: https://www.ibm.com/support/pages/node/720655

Notes for Linux people

  • Linux commands that commonly take -h args take -g and -m instead. I.e, du -m to list directory usage in MBs.
  • Use space instead of down arrow to scroll on man pages. Or just do man whatever | less to make it normal.
  • Not really an AIX thing, but https://github.com/amix/vimrc might be helpful, since most of our fancy IDEs probably don't work here.
  • Ususal hardware info utilities aren't there. For CPU info: prtconf -s && lsdev -Cc processor && bindprocessor -q For memory info: prtconf -m. For memory usage: vmstat. For disk usage: df -m.

On the off chance you have to mess with the AIX volume manager to expand filesystem sizes and such

  • I'm sorry

lspv will list the physical volumes. Physical volumes usually take the form hdisk*. A physical disk can't be manipluated or "touched" in a meaninful way until it's added to a volume group. If you're trying to add a new PV to the existing volume group, run extendvg rootvg hdisk1. If you run into partition count errors, try chvg -t 16 rootvg. lsvg rootvg will tell you the status of your volume group and free space.

If your volume group has sufficient space, you can extend the size of a logical voume using extendlv. To get a list of LVs, run df. The LV names are just the device mount point, ie /dev/hd4 uses the LV hd4. For example, to expand /opt/ by 10GB, run extendlv hd10opt 10G. To expand the filesystem backed by the LV, run chfs. For example: chfs -a size=+10G /opt.

Bashrc

export PATH=/usr/linux/bin:/opt/freeware/bin:$PATH
alias ls='ls --color=auto'

# get current branch in git repo
function parse_git_branch() {
       BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
       if [ ! "${BRANCH}" == "" ]
       then
               STAT=`parse_git_dirty`
               echo "[${BRANCH}${STAT}]"
       else
               echo ""
       fi
}

# get current status of git repo
function parse_git_dirty {
       status=`git status 2>&1 | tee`
       dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
       untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
       ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
       newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
       renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
       deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
       bits=''
       if [ "${renamed}" == "0" ]; then
               bits=">${bits}"
       fi
       if [ "${ahead}" == "0" ]; then
               bits="*${bits}"
       fi
       if [ "${newfile}" == "0" ]; then
               bits="+${bits}"
       fi
       if [ "${untracked}" == "0" ]; then
               bits="?${bits}"
       fi
       if [ "${deleted}" == "0" ]; then
               bits="x${bits}"
       fi
       if [ "${dirty}" == "0" ]; then
               bits="!${bits}"
       fi
       if [ ! "${bits}" == "" ]; then
               echo " ${bits}"
       else
               echo ""
       fi
}

export PS1="\u@\w:\`parse_git_branch\` "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment