Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smartree/1f6482e8deffa75fb04842c7f896e750 to your computer and use it in GitHub Desktop.
Save smartree/1f6482e8deffa75fb04842c7f896e750 to your computer and use it in GitHub Desktop.

Revisions

  1. @stephenturner stephenturner revised this gist Oct 12, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install-gcc48-linuxbrew-centos6.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install [Linuxbrew](https://github.com/Homebrew/linuxbrew) you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

    _Note_: Requires `sudo` privileges.

    ### Resources:

    - <http://superuser.com/a/676337/88393>: Forum response on using CERN's open Scientific Linux distribution of RHEL's developer toolset.
  2. @stephenturner stephenturner revised this gist Oct 12, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions install-gcc48-linuxbrew-centos6.md
    Original file line number Diff line number Diff line change
    @@ -59,6 +59,12 @@ GNU Fortran (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
    ...
    ```

    _Optional_: Permanently enable scl toolchain by putting this in your `.bashrc` (warning: don't try to use the `scl enable devtoolset-2 bash` command from before in your .bashrc. This spawns a new bash shell, and if that's in your .bashrc, it creates a new shell, which loads your .bashrc, which creates a new shell, etc.)

    ```
    source /opt/rh/devtoolset-2/enable
    ```

    ### Installing Linuxbrew

    Enable the SCL environment:
  3. @stephenturner stephenturner revised this gist Oct 12, 2015. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions install-gcc48-linuxbrew-centos6.md
    Original file line number Diff line number Diff line change
    @@ -20,25 +20,25 @@ CentOS release 6.7 (Final)

    Import CERN's GPG key:

    ```bash
    ```
    sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
    ```

    Save repository information as `/etc/yum.repos.d/slc6-devtoolset.repo` on your system:

    ```bash
    ```
    wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
    ```

    Install:

    ```bash
    ```
    sudo yum install devtoolset-2
    ```

    Enable the environment:

    ```bash
    ```
    scl enable devtoolset-2 bash
    ```
    @@ -63,36 +63,36 @@ GNU Fortran (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

    Enable the SCL environment:

    ```bash
    ```
    scl enable devtoolset-2 bash
    ```

    Create symlinks to your new gcc/g++/gfortran:

    ```bash
    ```
    ln -s $(which gcc) `brew --prefix`/bin/gcc-$(gcc -dumpversion |cut -d. -f1,2)
    ln -s $(which g++) `brew --prefix`/bin/g++-$(g++ -dumpversion |cut -d. -f1,2)
    ln -s $(which gfortran) `brew --prefix`/bin/gfortran-$(gfortran -dumpversion |cut -d. -f1,2)
    ```

    Install Linuxbrew:

    ```bash
    ```
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
    ```

    Add these to your `.bashrc`, and source it:

    ```bash
    ```
    export PATH="$HOME/.linuxbrew/bin:$PATH"
    export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
    export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    ```

    Test your installation:

    ```bash
    ```
    brew install hello
    brew test hello
    brew remove hello
  4. @stephenturner stephenturner created this gist Oct 12, 2015.
    99 changes: 99 additions & 0 deletions install-gcc48-linuxbrew-centos6.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,99 @@
    ## Installing gcc 4.8 and Linuxbrew on CentOS 6

    The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install [Linuxbrew](https://github.com/Homebrew/linuxbrew) you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

    ### Resources:

    - <http://superuser.com/a/676337/88393>: Forum response on using CERN's open Scientific Linux distribution of RHEL's developer toolset.
    - <http://linux.web.cern.ch/linux/devtoolset/>: CERN's developer toolset installation instructions.
    - <https://github.com/Homebrew/linuxbrew/wiki/Standalone-Installation>: Instructions for a standalone installation of Homebrew.
    - <https://twitter.com/sjackman>: Shaun Jackman -- the hero who maintains Linuxbrew.

    ### Upgrading gcc

    First, verify which version of CentOS you're using:

    ```
    $ cat /etc/centos-release
    CentOS release 6.7 (Final)
    ```

    Import CERN's GPG key:

    ```bash
    sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
    ```

    Save repository information as `/etc/yum.repos.d/slc6-devtoolset.repo` on your system:

    ```bash
    wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
    ```

    Install:

    ```bash
    sudo yum install devtoolset-2
    ```

    Enable the environment:

    ```bash
    scl enable devtoolset-2 bash

    ```

    Test the environment:

    ```
    $ gcc --version
    gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
    ...
    $ g++ --version
    g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
    ...
    $ gfortran --version
    GNU Fortran (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
    ...
    ```

    ### Installing Linuxbrew

    Enable the SCL environment:

    ```bash
    scl enable devtoolset-2 bash

    ```

    Create symlinks to your new gcc/g++/gfortran:

    ```bash
    ln -s $(which gcc) `brew --prefix`/bin/gcc-$(gcc -dumpversion |cut -d. -f1,2)
    ln -s $(which g++) `brew --prefix`/bin/g++-$(g++ -dumpversion |cut -d. -f1,2)
    ln -s $(which gfortran) `brew --prefix`/bin/gfortran-$(gfortran -dumpversion |cut -d. -f1,2)
    ```

    Install Linuxbrew:

    ```bash
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
    ```

    Add these to your `.bashrc`, and source it:

    ```bash
    export PATH="$HOME/.linuxbrew/bin:$PATH"
    export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
    export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    ```

    Test your installation:

    ```bash
    brew install hello
    brew test hello
    brew remove hello
    ```