From 422e47c141306a91c52905e891a047bc4c138b2b Mon Sep 17 00:00:00 2001 From: "David P. Chassin" Date: Mon, 10 Jan 2022 10:03:30 -0800 Subject: [PATCH] Update setup-Linux-amzn-2.sh (#1033) * Update setup-Linux-amzn-2.sh * update python3.9.6 installation * update mono installation * update converter support and latex installation * append global variable PATH=PATH=/usr/local/bin into /etc/profile. This file is a place for ec2 to hold global variable * try the final test * set environment variable in ec2 * update AWS ec2 reposity step in README * update EC2 installation process in README.md * modify README.md * update installation process in README.md * fix typo * update comment Co-authored-by: Catzzz --- README.md | 16 ++++++++++- build-aux/setup-Linux-amzn-2.sh | 51 +++++++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0ab78954f..f7f4e7c73 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,21 @@ Normally on Linux and Mac OS X developers should use the `install.sh` script to host% git clone https://github.com/slacgismo/gridlabd gridlabd host% gridlabd/install.sh ~~~ - +### AWS EC2 Installation +1) Set the path variable +~~~ +host% sudo su +host% export PATH=/usr/local/bin:$PATH +~~~ +2) Change work dictionary and clone GitHub repository +~~~ +host% cd /usr/local/src +host% git clone https://github.com/slacgismo/gridlabd gridlabd +~~~ +3) Run installation +~~~ +host% gridlabd/install.sh +~~~ To rebuild the source code and install again, use the `make system` command. You can use parallel builds using the `make -j system` command. If you have modified the branch name or version information, you must reconfigure your build using the `make reconfigure` command before using `make system`. diff --git a/build-aux/setup-Linux-amzn-2.sh b/build-aux/setup-Linux-amzn-2.sh index b70b4b1ac..e908fc5ee 100755 --- a/build-aux/setup-Linux-amzn-2.sh +++ b/build-aux/setup-Linux-amzn-2.sh @@ -1,7 +1,15 @@ #!/bin/bash # # Install script for Amazon EC2 instance -# + +# Set environment variable in EC2. +# In order to set the environment variable permanently, the system needs to be rebooted after the first time run this code. +# The other way around is to run `export PATH=/usr/local/bin:$PATH` before run `./install.sh` in the command line. +# The temporary `PATH` will be generated and used for installation. +# The `PATH` will be set permanently because of running `echo "export PATH=/usr/local/bin:$PATH" >> /etc/profile.d/setVars.sh` + +echo "export PATH=/usr/local/bin:$PATH" >> /etc/profile.d/setVars.sh && \ +source /etc/profile.d/setVars.sh chmod -R 775 /usr/local chown -R root:adm /usr/local @@ -16,8 +24,8 @@ yum -q install ncurses-devel -y yum -q install libcurl-devel -y # python3.9.x support needed as of 4.2 -if [ ! -x /usr/local/bin/python3 -o $(/usr/local/bin/python3 --version | cut -f-2 -d.) != "Python 3.9" ]; then - yum install openssl-devel bzip2-devel libffi-devel zlib-devel -q -y +if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version | cut -f2 -d.)" != "Python 3.9" ]; then + yum install openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel -q -y cd /usr/local/src curl https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz | tar xz cd Python-3.9.6 @@ -30,17 +38,29 @@ if [ ! -x /usr/local/bin/python3 -o $(/usr/local/bin/python3 --version | cut -f- ln -sf /usr/local/bin/idle3.9 /usr/local/bin/idle ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip3 curl -sSL https://bootstrap.pypa.io/get-pip.py | /usr/local/bin/python3 - /usr/local/bin/python3 pip -m install mysql-connector mysql-client matplotlib numpy pandas Pillow networkx + #/usr/local/bin/python3 pip -m install mysql-connector mysql-client matplotlib numpy pandas Pillow networkx + /usr/local/bin/python3 -m pip install matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd boto3 + /usr/local/bin/python3 -m pip install IPython censusdata fi + # mono if [ ! -f /usr/bin/mono ]; then - rpmkeys --import "http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef" - curl https://download.mono-project.com/repo/centos7-stable.repo > /etc/yum.repos.d/mono-centos7-stable.repo - yum -q install mono-devel -y + echo "Install mono" + cd ~ + wget https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/l/libpng15-1.5.30-13.fc35.x86_64.rpm + yum install -y ~/downloads/mono_dependencies/libpng15-1.5.30-13.fc35.x86_64.rpm + yum install yum-utils + rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" + yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ + yum clean all + yum makecache + yum install mono-complete -y + cd ~ + rm -rf /tmp/mono_deps fi -# natural_docs +# # natural_docs if [ ! -x /usr/local/bin/natural_docs ]; then cd /usr/local curl https://www.naturaldocs.org/download/natural_docs/2.0.2/Natural_Docs_2.0.2.zip > natural_docs.zip @@ -52,8 +72,15 @@ mono /usr/local/natural_docs/NaturalDocs.exe \$*' > /usr/local/bin/natural_docs chmod a+x /usr/local/bin/natural_docs fi -# converter support -# cd /tmp -# curl http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/m/mdbtools-0.7.1-3.el7.x86_64.rpm > mdbtools-0.7.1-3.el7.x86_64.rpm -# rpm -Uvh mdbtools-0.7.1-3.el7.x86_64.rpm +# # converter support + +echo "Install support" +cd ~ +amazon-linux-extras install epel -y +yum-config-manager --enable epel yum -q install mdbtools -y + +# # #latex +echo "Install latex" +yum -q install texlive -y +