Shellcheck: Instructions for how to install on Redhat and Centos 6

Created on 6 Aug 2015  路  5Comments  路  Source: koalaman/shellcheck

New to haskell and how it works, it took me a bit of digging on how to get it all working. Thought I'd share!

# Deps
yum groupinstall "Development Tools" -y
yum install gmp-devel # may need epel
sudo ln -s /usr/lib64/libgmp.so.3  /usr/lib64/libgmp.so.10

# From https://www.haskell.org/platform/linux.html#linux-generic 
wget https://haskell.org/platform/download/7.10.2/haskell-platform-7.10.2-a-unknown-linux-deb7.tar.gz
tar xvzf haskell-platform-7.10.2-a-unknown-linux-deb7.tar.gz
./install-haskell-platform.sh
cabal install shellcheck
cp .cabal/bin/shellcheck /usr/local/bin # portable to other el6 systems without haskell

:+1: for shellcheck

Most helpful comment

CentOS 6.7 RHEL6 instructions for shellcheck (includes 32bits i686):

  1. Based upon Haskell's documentation: https://www.haskell.org/downloads/linux
  2. Adds petersen ghc repository
  3. Installs updated cabal and ghc
  4. Updates cabal
  5. Installs shellcheck
  6. Copies the executable binary
# === As root ===
{
  # Add unofficial Fedora Copr repos
  curl https://copr.fedorainfracloud.org/coprs/petersen/ghc-7.10.3/repo/epel-6/petersen-ghc-7.10.3-epel-6.repo \
      > /etc/yum.repos.d/epel-petersen.repo;

  # Install Haskell
  yum install ghc cabal-install cabal-dev;

  # Prepare Haskell
  cabal update;
  cabal install cabal-install;

  # Install shellcheck
  cabal install shellcheck;
  cp -fv ~/.cabal/bin/shellcheck /usr/local/bin/;
}

All 5 comments

ThanksI I copied it to the wiki: https://github.com/koalaman/shellcheck/wiki/CentOS6

Why is that symlink necessary? That's a fairly intrusive thing to do and is almost always the wrong idea (i.e. messing with links in system directories like that).

a few comments on the build instructions. they almost worked for me, but:

sudo is needed on some of the other commands that are not marked as such.
/usr/local/bin needs to be in PATH.
it should be run from the $HOME directory, otherwise ".cabal" should be $HOME/.cabal .

shelltool is very useful. i wish it was easier to install.

CentOS 7 Instructions:

Do the above, but skip the symbolic link step. Did these cabal commands to make it work:

$ sudo PATH=/usr/local/bin:$PATH /usr/local/bin/cabal update
Downloading the latest package list from hackage.haskell.org

$ sudo PATH=/usr/local/bin:$PATH /usr/local/bin/cabal install shellcheck
Resolving dependencies...
Downloading json-0.9.1...
Downloading regex-tdfa-1.2.2...
Configuring regex-tdfa-1.2.2...
Configuring json-0.9.1...
Building regex-tdfa-1.2.2...
Building json-0.9.1...
Installed json-0.9.1
Installed regex-tdfa-1.2.2
Downloading ShellCheck-0.4.5...
Configuring ShellCheck-0.4.5...
Building ShellCheck-0.4.5...
Installed ShellCheck-0.4.5

NOTE: The above gets around the following issues I encountered:

$ sudo /usr/local/bin/cabal install shellcheck
cabal: The program 'ghc' version >=6.4 is required but it could not be found.
$ ghc --version

The Glorious Glasgow Haskell Compilation System, version 7.10.2
And then:

$ sudo PATH=/usr/local/bin:$PATH /usr/local/bin/cabal install shellcheck
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
cabal: There is no package named 'shellcheck'.
You may need to run 'cabal update' to get the latest list of available
packages.

CentOS 6.7 RHEL6 instructions for shellcheck (includes 32bits i686):

  1. Based upon Haskell's documentation: https://www.haskell.org/downloads/linux
  2. Adds petersen ghc repository
  3. Installs updated cabal and ghc
  4. Updates cabal
  5. Installs shellcheck
  6. Copies the executable binary
# === As root ===
{
  # Add unofficial Fedora Copr repos
  curl https://copr.fedorainfracloud.org/coprs/petersen/ghc-7.10.3/repo/epel-6/petersen-ghc-7.10.3-epel-6.repo \
      > /etc/yum.repos.d/epel-petersen.repo;

  # Install Haskell
  yum install ghc cabal-install cabal-dev;

  # Prepare Haskell
  cabal update;
  cabal install cabal-install;

  # Install shellcheck
  cabal install shellcheck;
  cp -fv ~/.cabal/bin/shellcheck /usr/local/bin/;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxisme picture maxisme  路  3Comments

helau picture helau  路  4Comments

nathaniel112 picture nathaniel112  路  4Comments

hugovk picture hugovk  路  4Comments

szepeviktor picture szepeviktor  路  4Comments