Computer (old posts, page 1)



The MediaWiki web site has an installation guide specifically for FreeBSD under “System-specific instructions” ( Read and follow this article. The following contains a summary of the steps involved.

  1. Install Apache, PHP, MySQL, and MediaWiki Using Packages:
    pkg_add -r apache22 mysql-server php5 php5-mysql mediawiki
    pkg_add -r php5-ctype #ParserFunctions extension for template logic
    pkg_add -r tidy #correct garbage HTML tags
    pkg_add -r inkscape #allow SVG upload and to enable thumbnail and preview rendering with Inkscape
    pkg_add -r php5-xmlreader #extract meta data from SVG files using the XMLReader PHP extension
    pkg_add -r ocaml ImageMagick ghostscript8 teTeX #TeX support

    Compile texvc:

    cd /usr/local/www/mediawiki/math/

    Reinstall php5 to include mod-php:

    cd /usr/ports/lang/php5
    make config
    make deinstall
    make reinstall

    During the make config step above, enable the “APACHE” option in the menu.

  2. Further configuration of PHP Some parameters of the wiki, such as maximum upload size and maximum PHP execution time must be set in PHP itself. Edit (or create) the file /usr/local/etc/php.ini:
    upload_max_filesize = 500M
    post_max_size = 500M
    session.save_path = "/var/lib/phpsess"
    max_execution_time = 600

    The temporary directory for PHP sessions, /var/lib/phpsess in this sample setup, should be owned by user www and have permissions 733. When you make changes to php.ini, you have to restart Apache for the changes to take effect:

    apachectl restart
  3. Set up MySQL
    • Check if the database server is running:
    mysqladmin status

    If it is not run mysqld_safe to start it:

    /mysqld_safe &

    Another way to start initially the MySQL server is to run the configure script available at the root of the installation. It creates the initial tables and automatically starts the mysql daemon

    • Set a password for the “root” account on your database server:
    mysqladmin -u root password new_root_password
    history -c
    • Run the MySQL command-line client:
    mysql -u root -p

    This will prompt for the “root” database password you just set, then connect to the MySQL server. Now, continue with the SQL commands below:

    create database group_wiki;
    grant index, create, select, insert, update, delete, alter, lock tables on group_wiki.* to 'wikiuser'@'localhost' identified by 'new_wikiuser_password';
    flush privileges;

    Start mysql-server:

    /usr/local/etc/rc.d/mysql-server onestart
  4. Set up Apache Add the following sections to /usr/local/etc/apache22/httpd.conf:
    LoadModule php5_module libexec/apache/
    <IfModule php5_module>
      DirectoryIndex index.php index.html
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps

    If you want to serve MediaWiki content exclusively, you can simply change the Apache document root to the MediaWiki installation directory:

    DocumentRoot "/usr/local/www/mediawiki"

    Also add an entry for the MediaWiki directory to httpd.conf:

    <Directory "/usr/local/www/mediawiki">
      Options Indexes FollowSymLinks
      DirectoryIndex index.php index.html
      AllowOverride None
      Order allow,deny
      Allow from all

    Restart Apache:

    apachectl restart
  5. Edit /etc/rc.conf Make sure your hostname in rc.conf contains a domain name, and that Apache and MySQL are set to start automatically during boot:
  6. Run the MediaWiki web installer Create the images directory for storing uploads if it does not exist yet:
    mkdir mediawiki/images

    Make sure all MediaWiki files belong to user www:

    chown -R www mediawiki

    Open http://localhost/mediawiki/mw-config/index.php in your browser to start installation. Enter root and your MySQL root password in the superuser name and password fields. After the installer has finished successfully, copy the resulting LocalSettings.php file to the MediaWiki root directory.

  7. Edit /usr/local/www/mediawiki/LocalSettings.php Change the relevant variables:
    $wgSitename, $wgMetaNamespace = "Siepmann Group Wiki";
    $wgLogo = "$wgScriptPath/where_the_logo_is.gif";
    $wgEmergencyContact, $wgPasswordSender = "";
    $wgDBname = "group_wiki";
    $wgDBuser = "wikiadmin";
    $wgDBpassword = "password";
    $wgDBadminuser = "wikiadmin";
    $wgDBadminpassword = "password";
    $wgEnableUploads = true;
    # User-added options
    $wgUseTidy = true;
    $wgFileExtensions = array_merge($wgFileExtensions, array('svg','tar','tar.gz','tgz','tar.bz2','tbz','tar.Z','tex','pdf','pptx','ppt','docx','doc','xlsx','xls','f','F','for','FOR','fpp','FPP','f90','F90','f95','F95','c','cpp','cxx','cc'));
    $wgSVGConverters = array('Inkscape' => '/usr/local/bin/inkscape -z -w $width -f $input -e $output',);
    $wgSVGConverter = 'Inkscape';
    $wgUseTeX = true;
    $wgJobRunRate = 0;
    $wgExternalLinkTarget = '_blank';
    $wgMimeTypeBlacklist = array(
       # HTML may contain cookie-stealing JavaScript and web bugs
       'text/html', 'text/javascript', 'text/x-javascript',  'application/x-shellscript',
       # PHP scripts may execute arbitrary code on the server
       'application/x-php', 'text/x-php',
       # Other types that may be interpreted by some servers
       'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
       # Client-side hazards on Internet Explorer
       'text/scriptlet', 'application/x-msdownload',
       # Windows metafile, client-side vulnerability on some systems
       # A ZIP file may be a valid Java archive containing an applet which exploits the
       # same-origin policy to steal cookies
       # MS Office OpenXML and other Open Package Conventions files are zip files
       # and thus blacklisted just as other zip files. If you remove these entries
       # from the blacklist in your local configuration, a malicious file upload
       # will be able to compromise the wiki's user accounts, and the user
       # accounts of any other website in the same cookie domain.
  8. Install extensions
    • wikEd (or CKEditor): add the complete version of the installation code to the MediaWiki:Common.js page.
    // install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
    + '&action=raw&ctype=text/javascript');
    • GeSHi: download and extract it to the extensions directory.
    • GeSHiCodeTag: create a new file in the extensions directory called GeshiCodeTag.php which should contain the source code, replace the line:
    $languagesPath = "extensions/geshi/geshi";


    $languagesPath = "$IP/extensions/geshi/geshi";

    in the file, and finally add the following line to LocalSettings.php.

    ## GeshiCodeTag extension
    • SyntaxHighlight GeSHi: download and extract it to the extensions directory, replace the line:
    require( 'geshi/geshi.php' );


    require( '../geshi/geshi.php' );

    in SyntaxHighlight_GeSHi.class.php, and finally add the line:


    to LocalSettings.php.


Software files will be updated when updating FreeBSD (such as by portupgrade), but the database should be checked afterwards:

cd /usr/local/www/mediawiki/maintenance
php update.php

Certain extensions may need to be updated manually, and LocalSettings.php may also need to be adjusted as documented in the “configuration changes” section of the release notes. It may be necessary to place the database in read-only mode first which prevents user edits:

$wgReadOnly = 'System upgrading';


Remember to backup both the database and file system.



Assuming MediaWiki has already been installed, this description only deals with the Drupal specific parts.

  1. Install Drupal7
    pkg_add -r drupal7 php5-gd
  2. Create the configuration file and grant permissions
    cp sites/default/default.settings.php sites/default/settings.php

    Give the web server write privileges (666 or u=rw,g=rw,o=rw) to the configuration file:

    chmod a+w sites/default/settings.php

    Give the web server write privileges to the sites/default directory:

    chmod a+w sites/default
  3. PHP settings
    Edit /usr/local/etc/php.ini:
    apc.rfc1867 = 1

    Restart Apache for the changes to take effect:

    apachectl restart
  4. Create the Drupal database
    mysqladmin -u root -p create group_web
    mysql -u root -p

    At the MySQL prompt, enter:

  5. Set up Apache
    Add an alias for the Drupal directory between and
    Alias /drupal7 /usr/local/www/drupal7

    Also add an entry for the Drupal directory to httpd.conf:

    <Directory "/usr/local/www/drupal7">
       Options Indexes FollowSymLinks
       DirectoryIndex index.php index.html
       AllowOverride None
       Order allow,deny
       Allow from all

    Restart Apache:

    apachectl restart
  6. Run the installation script Point your browser to the Drupal site: http://localhost/drupal7, and follow the wizard to set up the database, add the first user account, and provide basic website settings.
  7. Install extensions
    • Download the following modules from Drupal Module project: wysiwyg, biblio, media(which requires ctools, views, file_entity), filedepot (which requires libraries).
    • Install by extracting them to site/all/modules and enabling them in Administration > Modules (see Installing modules and themes for more information).
    • Go to Administration > Modules, review the Permissions settings for the newly installed modules and modify them as necessary.
    • Go to Administration > Modules > Wysiwyg > Configure, and follow the instructions to install CKEditor.
    • Follow the instructions in the README file for filedepot to set it up.


Log in as an administrator user, go to Administration > Configuration > Development > Maintenance mode. Enable the “Put site into maintenance mode” checkbox and save the configuration. Update software files by updating FreeBSD (such as using portupgrade), and run update.php through the browser to update the database.


Remember to backup both the database and file system. You can also create a backup tarball at administer >> content >> backup.

Installing Linux on Microsoft Windows using VirtualBox

We like Mac machines because their operating system is essentially a BSD variant that can work seamlessly with the Unix world and is popular enough that companies like Microsoft and Adobe would care to develop versions of their products specifically for the platform. Nice as this is, when it comes to buying computers ourselves, we may not always want to buy Mac for various reasons and as a result we have to resort to work-around methods like this article describes, to get Unix stuff work under Microsoft Windows without the need for dual-booting. Windows is picked as the host OS here because most vendor-provided hardware drivers are only available for Windows, and therefore graphics performance, battery life, etc. tend to be better. For more information, such as Ubuntu gets inside Windows, and how to use Linux as the host OS and run Windows both within Linux and native:Windows 7: In both VM and native (using Linux as host OS), HOWTO: Windows XP in both VM and native, and Taming Windows 7 in a VirtualBox VM Using Raw Disk Access, and more on VDIs: Tutorial: All about VDIs and HOWTO: manage VDIs and import native installations.

  1. To allow multiple operating systems to share the processor resources efficiently and safely, many processors now support hardware virtualization. You will need to enable this in BIOS. You can enter the BIOS configuration often by pressing the ESC, DEL, F2, or F12 key during system booting. For Intel chips, the name for the hardware virtualization option is often called “Intel’s VT-x”. To do this in Windows 8, follow the steps 1
  2. Download a copy (ISO image) of the operating system you want to install, such as Ubuntu. The 64 bit version is used here for demonstration purposes.
  3. Download and install VirtualBox and, optionally, the Extension Pack.
  4. After installation, run VirtualBox as administrator, click button “New” to create a new virtual machine.
  5. You can choose whatever Name for the virtual machine. For OS Type, choose Linux as Operating System, and Ubuntu (64 bit) as Version.
  6. Depending on the total amount of memory, select an appropriate amount of memory you want the virtual machine to be able to use.
  7. If this is the first time you create a new virtual machine, you will need to create a virtual hard drive to be used in the guest OS.
    • In the Virtual Disk Creation wizard that pops up, choose VDI as virtual hard disk file type. The other file types are from other virtual machine software programs; for details, see Chapter 5. Virtual storage#Disk image files (VDI, VMDK, VHD, HDD).
    • You can allow the virtual disk file to grow in size dynamically as it fills up, or to allocate a fix amount of space at its creation. The guest OS will always see the hard disk with a size you specify in the next page, no matter which option you choose. It is only a matter of efficiency.
    • Choose the location to save the virtual disk file and select its size. For a typical Linux installation with additional software we are going to use, the default size should be sufficient. However, selecting a larger size such as 20 or 40 GB could be safer.

    ADVANCED: if you want to be able to both run Ubuntu in VirtualBox under Windows and boot into native Ubuntu or if you already have a dual-boot setup and want to import the Ubuntu installation to VirtualBox, you will need to use raw disks/partitions as virtual disks. Read more about Using a raw host hard disk from a guest

    • Check which partitions you will be using:
    C:\Program Files\Oracle\VirtualBox> VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
    • Create vmdk for the whole disk
    C:\Program Files\Oracle\VirtualBox> VBoxManage.exe internalcommands createrawvmdk -filename C:\somewhere\ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -register

    or create vmdk for select partitions

    C:\Program Files\Oracle\VirtualBox> VBoxManage.exe internalcommands createrawvmdk -filename C:\somewhere\ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 3,5,6 -register
    • Make a bootable GRUB CD to be used during the booting phase of the guest OS:

    mkdir -p iso/boot/grub cp /boot/grub/grub.cfg iso/boot/grub grub-mkrescue -o grub.iso iso And copy “grub.iso” to your host OS and mount it as CD during booting (either directly to a shared folder or to a USB flash drive, etc.).

  8. Click “Settings”, select “Storage” from the left panel, you can choose the Ubuntu iso image to be mounted as CD/DVD (often the entry belonging to Controller: IDE) for the guest OS. Save the settings.
  9. Click “Start” to boot the guest OS, now consider what happens inside VirtualBox as happening in another real machine, and install the guest OS as you would for a real machine. This means you might need to press the ESC, DEL, F2, or F12 key to make it boot from CD.
  10. After installing the guest OS, boot into it, and then select Devices -> Install Guest Additions from the menu of the VirtualBox window containing the running guest system. This will install software that will offer the guest OS a few nice features, see Chapter 4. Guest Additions.
  11. After installing the Guest Additions, you can select Devices -> Shared Folders to add folders from your host OS (Windows) that you want the guest OS (Ubuntu) to be able to access. You can make them permanent and auto-mount. To see if auto-mount works, use “mount” or “df -h” and check their output. HOWTO: Use Shared Folders explains a little bit more on how to use shared folders in Linux guest OS.

Setting up Linux

Customizing shell

  1. .bashrc is a login file that the Bash shell reads whenever it starts. This is where you can put configurations (environment variables, aliases, path amendments, etc.) to customize your Terminal experience. An example of a .bashrc file is included here. As you become more comfortable with Linux/Unix, you may find you modify this file frequently.
  2. The file should be located in your home directory (~/), and you need to create it if it does not yet exist. Open and save the file with the editor of your choice. You will not need the sudo command since this file is now in your home directory and you have write permission. If you use vi, just type vi ~/.bashrc at the prompt.
  3. Use the copy and paste commands to put the following lines into your .bashrc file.
    # Amend environment variables
    export PATH="$PATH:."
    # Set prompt
    PS1='\[\e]2;\w\a\]\u@\h:\[\e[1m\]\w\[\e[0m\]\$ '
    # User Specific Aliases
    umask 077
    export CLICOLOR=1
    alias edm='emacs --daemon'
    alias ecl='emacsclient --create-frame'
    alias enw='emacsclient -nw'
    alias grep='grep --color'
    alias less='less -Ri'
    alias la='ls -ahlF'
    alias lh='ls -hlF'
    alias rbak='\rsync -rltDzP --delete --delete-excluded --force'
    alias rsync='rsync -azP'
    alias ssh='ssh -Y'
    if [ $os_name == 'Darwin' ]; then
      alias top='top -ocpu -Otime -F -R'
    elif [ $os_name == 'FreeBSD' ]; then
      alias vi='vim -c "syntax on"';
      alias qm='qstat -u $USER'
      alias qI='qsub -I -X -V -l nodes=1:ppn=8,walltime=1:00:00 -q devel'
      alias sm='showq -u $USER'
      alias sq='squeue -o "%.18i %.9P %.30j %.8u %.2t %.10M %.6D %R"'
      alias sqm='sq -u $USER'
    alias itasca='ssh'

    The first section is where modifications to the environment variables go. An example of this is addition to the PATH used to search for executable commands. In this example, the . adds the working directory to the existing path ($PATH), so any executables you create in whatever directory you are working in can be referenced directly.

    The next section is the specification for the style of the prompt. This prompt is set to display username@hostname:/working/directory$ in bold font. It also sends the same information into the title bar of the terminal window (either Terminal or X-terminal). This is default behavior on Unix machines, but needs to be specifically configured on Mac machines. Writing information about the hostname and working directory into the title bar helps keep track of multiple windows logged in to multiple machines. For more information on setting prompts in the bash shell, search online for the bash prompt HOWTO.

    The last section contains user-specified command shortcuts. The long command, shown in quotes, is linked to whatever series of key strokes (preceding the equal sign) you specify in this file. This example includes two list commands, lh, and la. The hlF flag list files with information about their size and when they were created. The a option lists hidden files (all files that start with .). An aliased SSH connection is created to the MSI machine Itasca. When you paste these lines into your own file, be sure to change ‘username’ to your specific username. You can add your own aliases as they become more useful to you over the course of your research.

  4. Save the file and exit (:wq or :x for vi).
  5. Tell the computer to begin reading your new ~/.bashrc settings
    source ~/.bashrc

Setting up Mac OS X

Installing Xcode Developer Tools and its Command Line Tools

  1. Xcode can be found from your Mac OS X installation media, the Mac App Store, or Apple Developer Connection site.
  2. For OS X 10.7 or later, Command Line Tools needs to be installed separately. Download and install it either from Apple Developer Connection site, or from XCode, choose Preferences -> Downloads and then click “install” next to the “Command Line Tools”.

Installing X-Window system

X11 is a software system and network protocol that provides a basis for graphical user interfaces (GUIs) and rich input device capability for Linux/Unix applications. Normally, it will run in the background and, with the exception of an icon on your dock, will be unnoticeable.

  1. Since OS X 10.8, is not shipped with the OS, and need to be installed from XQuartz or using Homebrew (see below). NOTE: You should NOT set the DISPLAY variable in any system configuration files or the X11 forwarding will be disabled.
  2. The default behavior for X11 applications is to open a xterm terminal at start-up. With the superior features of the Terminal applications, you will be unlikely to have need of this xterm terminal. To disable it, open a Terminal window and enter the following:
    defaults write org.x.X11 app_to_run /usr/bin/true
  3. In the Preferences menu, under the Input tab, make sure “Enable key equivalents under X11” is unchecked. This is going to make any meta-key functions in Emacs work properly. However, the drawback is that none of the Apple functions (such as apple-S for save, or apple-Q to close) will work in your X-window programs. It is a trade-off — either Emacs works “normally” or the apple functions work “normally” in X-windows. My preference is to have Emacs working since this is a commonly used program, while the apple functions are really just keyboard shortcuts that can all be done a different way.

Package management systems

There exist a few package management systems that port free/open source Unix/Linux software to Mac OS X, including Homebrew, MacPorts, Fink, rudix, stow. Homebrew, MacPorts, Fink are the more popular choices. Use Homebrew if you haven’t yet settled on one. Fink builds on Debian’s packaging tools and apt-get, and has pre-compiled executables. MacPorts is strongly influenced by BSD’s ‘ports’ system and builds everything from source code. Homebrew makes maximum use of what comes with OS X and does not need root/sudo to install packages. In addition, Homebrew Cask extends support to other OS X applications (such as Chrome) and let you skip the step-by-step installation process. MacPorts and Homebrew are more up to date than Fink, but Fink tends to have more scientific applications.

List of useful packages

Some of the packages (git, numpy/scipy/matplotlib) below come with the Command Line Tools of Xcode, but they are usually not the latest versions.

  • CMake - a cross-platform build system; easier to use than Autotools or writing Makefiles, and will be used as the default build system for the group code
  • GIMP - an open-source program similar to Adobe Photoshop
  • Git - a distributed version control system used to manage code development in our group; you must learn to use it, see Git_Guidelines
  • gnuplot - another plotting program
  • Inkscape - an open-source SVG vector graphics editor
  • MacTeX or TeX Live - the TeX typesetting program, includes latex
  • Sublime Text - A text editor for code, markup and prose

Some people may find the following also useful:

  • Emacs or XEmacs - a customizable text editor
  • Hunspell - a spell-checker program.
  • ImageMagick - a software suite to create, edit, compose, or convert bitmap images
  • NumPy/SciPy/matplotlib/pandas - Python extensions that define numerical array and matrix type and associated basic operations and support advanced math, signal processing, optimization, statistics, plotting and much more
  • Octave - a Matlab-like environment for numerical computation and graphics
  • R - a statistical computing and graphics environment
  • Xmgrace - a program for making scientific graphs

Using Homebrew

  1. Read more on Homebrew’s home page, but basically installation is a one-liner
    ruby -e "$(curl -fsSL"
  2. To install new packages, simply type “brew install packagename(s)” at the command prompt. To search for a package, use “brew search packagename”.
  3. If you haven’t, you can install X11 through Homebrew Cask with:
    brew install cask
    brew cask install mactex xquartz
    brew cask install firefox google-chrome skype sublime-text vlc # choose as you see fit
  4. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation (remove the “-y” switch to answer each of them yourself).
    brew tap homebrew/x11
    brew tap homebrew/science
    brew install cmake gimp git gnuplot inkscape

Using MacPorts

  1. MacPorts has a “pkg” installer and the instructions for installation are straightforward.
  2. To install new packages, simply type “sudo port install packagename(s)” at the command prompt. To search for a package, use “port search packagename”. The full list of available packages is found on the MacPorts website on the Available Ports page.
  3. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation.
sudo port install cmake emacs gimp git gnuplot grace hunspell imagemagick inkscape octave py-matplotlib py-numpy py-scipy R texlive

Using Fink

  1. Fink used to also have a binary installer, but as of 03/25/2008 it is not available for Leopard or later OS X versions. You will need to follow the instructions on the Download page on Fink website.
  2. To install new packages, simply type “fink install packagename(s)” at the command prompt. To search for a package, use “fink apropos packagename”. The full list of available packages is found on the Fink Project website on the Packages page.
  3. To install everything at once, use the following command. Keep in mind this will take a long time to complete and will accept the default option for all questions during the installation (remove the “-y” switch to answer each of them yourself).
fink -y install cmake emacs24 gimp2 git gnuplot grace hunspell imagemagick inkscape octave matplotlib-py27 scipy-py27 numpy-py27 r-base texlive
Password: (enter your password)

Visualization software

Install Schrodinger, Jmol, and VMD.

Set up ssh-agent

  • Generate a key pair following the first bullet point under SSH-Agent , and skip the rest.
  • Follow “On MacOS” in GPG-Agent.
  • Add the lines under “Useful common settings”.

Setting up .ssh/config

Follow the steps in Customizing .ssh/config and set up Sharing sessions over a single connection and Host alias. Leave Multi-hop for later when you need it but do keep in mind of this option.

Customizing shell

Follow this part in Setting up Linux.

Customizing Terminal

  1. Open a Terminal window: find the Terminal icon again and double-click to open it. You can add this icon to your dock if you want (I recommend this since you will probably use Terminal more than any other application) by clicking and dragging the icon onto the dock.
  2. Once you have a Terminal window open, go to Terminal -> Preferences -> Settings. On the left is a series of included styles for the Terminal window. These are similar to PowerPoint templates. If you like one of them, simply highlight it and click on Default at the bottom of the list. This will make that style your default Terminal style.
  3. If you are interested in fuller customization, there are several things you can change. Explore the tabs in the Settings menu to see what can be modified. You can change font style and size, text color, bold text color, highlight color, transparency, background color, etc.
  4. To make your terminal function more like a Unix terminal with familiar key functions, I recommend changing the following settings:
    • Shell: where it says: “When the shell exits”, select “Close only if the shell exited cleanly”.
    • Keyboard: Change the following key bindings
    • End: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: type option-ctrl-[ together, then release and type [ followed by F. If you did this successfully, you will see \033[F on the line.
    • Home: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: option-ctrl-[ then [ and H
    • Page down: highlight and click on “edit.” Modifier: none. Action: “send string to shell.” Key sequence: option-ctrl-[ then [ 6 ~
    • Page up: highlight and click on “edit.” Again, the modifier is “none” and the action is “send string to shell.” The key sequence is option-ctrl-[ then [ 5 ~.
    • Shift end: highlight and click on “edit.” Modifier: shift. Action: “scroll to end of buffer.”
    • Shift home: highlight and click on “edit.” Modifier: shift. Action: “scroll to start of buffer.”
    • Shift page down: highlight and click on “edit.” Modifier: shift. Action: “scroll to next page in buffer.”
    • Shift page up: highlight and click on “edit.” Modifier: shift. Action: “scroll to previous page in buffer.”
  5. The various color schemes also serve a purpose. You can create a library of different backgrounds corresponding to different work locations. Most of the work done in our lab involves remote connections to several computers, often multiple connections at the same time. I find the different backgrounds and colors, along with adding fun and interest to my screen, helps me keep straight which computer I am connected to at any given time. You can modify any of the existing color schemes or create your own.
    • In the Shell tab, check the box next to ‘Run command:’ and add the name of an aliased SSH command in the text box. Any time this particular Terminal profile is opened, it will automatically connect to the computer specified in the SSH command. The result will be a differently colored window open with a remote connection to a specific machine.
    • To open these customized windows, select New Window from the Terminal menu bar. A drop down list of the profiles you created will appear. Selecting any of them will open the new window with appropriate connection.

Setting up Shared Mac

This document walks through the basic set up procedures for configuring the Mac Pro in a computational research environment. If this is a new machine, start with Account Initiation. If this is an existing machine and you only need to create a new account for yourself, begin with Create user account and Modify /etc/sudoers in Account Initiation and then follow Customization.

Account initiation

NOTE: This must be done by the computer administrator.

Setting a root account password

  1. Choose System Preferences in the Apple menu and click on Accounts.
  2. There will only be one account, the one created by the Electronics Shop. This account is your root account and has all the administrative privileges. You need to change the password from the default given by the Electronics Shop to something else.
  3. Check the box next to ‘Allow user to administer this computer’.

Creating user account

  1. While in the Accounts menu of System Preferences, click on the + button in the bottom left corner and fill in the form with appropriate information. (You may need to first click the lock and enter the credentials to enable changes.) Keep in mind that once the “Short Name” is set, it cannot be changed. This will become the name of your home directory and the only way to change it is to create a new user account.
  2. Choose a picture by clicking on the picture icon if you like.
  3. Make sure the account type is ‘Standard’. If the “Allow user to administer this computer” box is checked,‘ uncheck‘ it. This is a simple safety system that will force you to enter the root password for any major modifications and prevent you from making any serious mistakes inadvertently.
  4. Select Login Options at the bottom of the list of users. Disable the automatic login, and select the checkbox “Enable fast user switching.” Fast user switching is a way to allow multiple users to log in at the same time and switch between desktops.

Modifying /etc/sudoers

  1. The file /etc/sudoers is a file that contains the usernames of users with advanced permissions. You want to add your name to the file to allow yourself administrative privileges for some of the linux-side applications.
  2. Open a Terminal window. The Terminal launch icon can be found by opening the Finder (the “face” icon in the task bar at the bottom of the desktop), clicking on the Applications menu in the side-bar, and scrolling down to the Utilities folder where Terminal is located.
  3. A new window will open with a command prompt. At the prompt, type the following commands:
sudo visudo
Password: (enter the '''root''' password)

This will open a file and change the screen to look similar to the one shown below. To modify this file, move the cursor to the bottom of the ‘User privilege specification’ section (use arrow keys). Next type shift-A. This will take you to the end of the last line, and change to insert mode (the word insert should appear at the bottom of the page). Then enter a carriage return to begin a new line and type username ALL==(ALL) ALL as in the example file shown below. To exit, press the escape key, and then type :wq! . MacOSX_setup_etc_sudoers.png

Logging in to your account

  1. With Fast User Switching enabled, you should be able to click on the user name displayed in the upper right hand corner of the desktop.
  2. In the dropdown list, find your account name and click to log in.

Performance and security settings

Modifying system preferences

  1. In the Apple menu, choose System Preferences.
  2. Configure processor performance and “sleep” functions:
    • Click on Energy Saver.
    • Slide the bar to “Never” for “Computer sleep”.
    • Move the slider to your desired setting for “Display sleep”.
    • Check ‘Wake for Ethernet network access’ and ‘Start up automatically after a power failure’.
    • Return to the main System Preferences menu by clicking on Show All in the top menu bar.
  3. Configure printers
  4. Allow remote SSH access:
    • Click on Sharing.
    • Check the box next to Remote Login.
    • Return again to the main System Preferences menu.
  5. Configure the firewall:
    • Click on Security.
    • Under the ‘General’ tab, check the box for ‘Require password after sleep or screen saver begins’, ‘Disable automatic login’, and ‘Use secure virtual memory’.
    • Under the ‘Firewall’ tab, select ‘Set access for specific services and applications.’ The programs displayed in the list should reflect the choices made in the Sharing system preference (i.e., remote login (SSH) and possibly Apple Remote Desktop)
    • Return once again to the main System Preferences menu.

Modifying /etc/profile

  1. The file /etc/profile is a configuration file that the computer reads at start up. In this file, you can specify environment variables that will be applied system-wide to all users. The changes made here include the PATH and TERM variables. The PATH environment variable tells your computer where to look for command files (executables). Those included in this file are the default directories where commands are typically found. TERM is the environment variable that tells your computer what type of terminal you want. xterm-color allows you to have terminals with colored directories. Specifying this variable here forces Terminal and X-terminal to have the same type. If the variable is left unspecified, Terminal is by default xterm-color, but X-terminal is just xterm.
  2. Still in the terminal window, type the following command:
    sudo vi /etc/profile
    Password: (enter your password)
  3. Modify the file to look similar to the one shown below. To insert text using the vi editor, type the letter i. This will switch vi into insert mode and the word insert should appear at the bottom of the terminal window. You can type normally in insert mode. The added lines include two environment variables that are read by the computer at start-up.
  4. When the file is updated, you want to apply it to the current terminal session:
    source /etc/profile


Configuring the tcp wrapper

  1. The tcp wrapper is a security feature that allows you to specify exactly who can have access to your computer via SSH. Once configured, it will block all incoming IP addresses except for the ones you specify.
  2. Once again using your favorite editor, create a new file called /etc/hosts.allow. Remember that this file is in the root account, so you will need the sudo command to gain access. (For example, type sudo vi /etc/hosts.allow)
  3. In the blank file, copy and paste the following lines:
    ALL : : allow
    ALL : : allow
    ALL : : allow
    ALL : your.home.ip.address : allow
    ALL : ALL : deny
  4. This file works in the following manner. The ALL refers to the services that you are granting access to. With a Linux machine, you could be even more specific and replace ALL with SSHD. This would only allow SSH access from the machines with the designated IP addresses (or host names associated with each IP address). On the Mac, the SSH program was not compiled with the same tcp configuration, and using SSHD in place of ALL does not have the desired effect. However, remember that when you turned on your firewall, you blocked every service but SSH, so on the Mac, using ALL is effectively the same as using SSHD. The next part of the line is either a computer’s hostname or the computer’s IP address, or part of an IP address. After the hostname comes the allow/deny statement that tells the computer whether to allow access or deny it. Allowed IP addresses under this configuration are, in order of checking, addresses coming from the chemistry department at the University of Minnesota, or those coming from a Minnesota Supercomputing Institute supercomputer (, or those from the chemical engineering and materials science department, or your home IP address. Anything that fails to match one of those specifications is denied access.

Enabling X11 forwarding by SSH

  1. This behavior is default on most linux boxes and will be required for remote logins. Setting this forwarding feature allows anyone with an account on your machine to use the X11 programs when they connect remotely.
  2. Open the file /etc/sshd_config:
    sudo vi /etc/sshd_config
    Password: (enter your password)
  3. Once the file opens, type /X11 so vi will search and find the line:
    X11Forwarding no

    With the cursor on that line, type i to move into insert mode, and comment out the line

    #X11Forwarding no

    or modify it to allow X11 forwarding:

    X11Forwarding yes