You are here: Home / Groups / Short-Term Crustal Dynamics / Wiki / Installing PETSc on EC2/Linux
  • Discoverability Visible
  • Join Policy Invite Only
  • Created 05 Jan 2021

Installing PETSc on EC2/Linux

Contributed by Tabrez Ali 22 January 2015

This is part of a longer instructions to install Defmod but walks you through a PETSc install if you want to compile from source. This should also work for any Linux machine.

Instructions for installing Defmod on Amazon’s Elastic Compute Cloud (EC2):

1. Launch an Ubuntu (Server, 14.04 LTS) based instance (e.g., t2.micro) and login using your key:

ssh -X -i "key" ubuntu@xxx.xxx.xxx.xxx

2. Fix ‘/etc/hosts’ (keeps MPICH happy):

sudo sh -c 'echo 127.0.1.1 `hostname` >> /etc/hosts'

3. Download GNU compilers and other required tools/utilities:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc gfortran libblas-dev liblapack-dev cmake mercurial

4. Download, configure and install PETSc with METIS:

wget http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.6.3.tar.gz
tar -xzf petsc-3.6.3.tar.gz
cd petsc-3.6.3
export PETSC_DIR=`pwd` PETSC_ARCH=arch-linux2-c-opt
./configure --with-cc=gcc --with-fc=gfortran --download-mpich --download-metis --with-debugging=0
make all
export PATH=$PATH:$PETSC_DIR/$PETSC_ARCH/bin

Note: If CMake complains about missing C++ compiler during the configure step above, then edit

$PETSC_DIR/$PETSC_ARCH/externalpackages/metis-5.1.0-p1/CMakeLists.txt and change "project(METIS)
to
project(METIS C)

Created on , Last modified on