Where can I get the files to install f2c on redhat linux? - linux

I am looking for an rpm or simple install instructions for getting f2c to work on my redhat linux os. I am new to linux and it is difficult finding something like this on google.
(The goal is to use f2c to convert a simple fortran77 file to c, then compile)
Does anybody have any suggestions?

Getting the source with rsync (recommended):
$ rsync -avz netlib.org::netlib/f2c/src f2c
Getting the sources via FTP:
$ mkdir -p f2c/src
$ cd f2c/src
$ ftp ftp.netlib.org
ftp> cd f2c
ftp> prompt
ftp> mget *
To build the sources, in the f2c/src directory do:
$ make -f makefile.u
To install the binary, copy it to a directory in your $PATH:
$ mkdir -p /usr/local/bin /usr/local/man/man1
$ cp f2c /usr/local/bin
$ cp f2c.1t /usr/local/man/man1
To compile Fortran programs you will also need libf2c:
$ mkdir libf2c
$ cd libf2c
$ unzip ../libf2c.zip
$ make -f makefile.u
$ make -f makefile.u install LIBDIR=/usr/local/lib
libf2c is a combination of the libF77 and libI77 libraries. You can install these libraries separately and then link with "-lF77 -lI77". Assuming f2c/src is available from the current directory, save libF77 and libI77 and do the following (not necessary if you have already installed libf2c above):
$ sh libf77
$ sh libi77
$ cd libF77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
$ cd ../libI77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
The fc shell script is a nice frontend to use with f2c. Save it somewhere and do:
$ cp fc /usr/local/bin/f77
$ chmod 755 /usr/local/bin/f77
I renamed it to f77 to avoid conflicts, since fc is a bash builtin. The fc script expects libf2c rather than libF77 and libI77, so you have to edit it and replace "-lf2c" with "-lF77 -lI77" if you have installed these libraries instead of libf2c above.
Finally, to compile your program you can do:
$ f77 source.f -o binary
Also check out the f2c parent directory. It contains getopt.c, f2c.pdf and some other stuff that may be useful.
For more further information about f2c consult the readme (less f2c/src/readme) and the manpage (man f2c). For further information about the fc script look at the comments at the beginning of the file.

You can get a precompiled f2c package from ATrpms: http://atrpms.net/name/f2c/
It does include both the headers (such as f2c.h) and the library (libf2c) in standard directories, so you shouldn't have any trouble compiling after that.
Otherwise, you could try to compile directly with a free Fortran compiler; try gfortran. If not installed, it's in package gcc-gfortran, so you can install it with the command: yum install gcc-gfortran.

Related

Unable to build openssl-1.0.2n on LinuxMint

I am trying to update my OpenVPN and OpenSSL.
While updating openvpn to openvpn-2.4.4, I was required to update my openssl first to the latest openssl-1.0.2n
$ cd~
$ wget https://openvpn.net/index.php/download/openvpn-2.4.4.tar.gz
$ sudo tar -zvxf openvpn--2.4.4.tar.gz
$ cd openvpn-2.4.4
$ sudo ./configure
$ sudo make
$ sudo make install
But when I reach ./configure above, I run into an issue with legacy openssl as I have mentioned earlier (i thought an update would fix that):
checking tap-windows.h presence... no
checking for tap-windows.h... no
checking whether TUNSETPERSIST is declared... yes
checking for setcon in -lselinux... no
checking for pam_start in -lpam... no
checking for PKCS11_HELPER... no
checking for OPENSSL... no
checking for SSL_CTX_new... no
configure: error: openssl check failed
So I tried the following commands to update to the latest openssl :
$ cd /usr/src
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ sudo make
$ sudo make test
$ sudo make install
$ mv /usr/bin/openssl /root/
$ ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
$ openssl version
When I get to make test, I run into a compilation error. I have copy pasted my terminal output here because that output is HUGE, error is in the bottom : pastebin
Any suggestions how I can move past this issue?
RELEASE=18 sarah, EDITION=Cinnamon 32-bit, GRUB_TITLE=Linux Mint 18 Cinnamon 32-bit
Judging from your output, you need to run all three commands as sudo, and you missed the initial make.
elliot#warmachine /usr/src/openssl-1.0.2n $ sudo ./config
...
elliot#warmachine /usr/src/openssl-1.0.2n $ make
...
/bin/sh: 1: cannot create buildinf.h: Permission denied
Makefile:58: recipe for target 'buildinf.h' failed
which fails as it does not have permissions to write to the directory, which causes sudo make test to fail because openssl hasn't been built:
/usr/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status
-l{library_name} is what ld uses to link in external libraries, meaning test cannot find the openssl .so that should have been built in previous steps
Lastly, it is bad practice to build software as root. My recommendation is to build it as an unprivileged user, then install as root.
$ cd ~
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ make
$ make test
$ sudo make install

Why do I need to sudo to use leiningen (installed in /bin) on Linux?

I installed leiningen on fedora, I followed the instruction:
download the script
Paste the script(via command line) to ~/bin (PATH)
Execute the script
Run lein(I had to did it with sudo) to self-install
but every time I want to run the "lein" command, I have to do it with "sudo".
How can i fix this? or what can i do to fix this?
Note: I installed leiningen at /bin but when i cd ~/bin as the installation guide said i get and error about the folder(not exist).
You installed it in /bin and ran it with sudo to install the lein jars initially, which means they are owned (and probably only readable) by root. You should install the script at ~/bin instead. You can fix it like this:
sudo rm /bin/lein
sudo rm ~/.lein
mkdir ~/bin
cd ~/bin
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
export PATH="${HOME}/bin:${PATH}"
lein
You should also add ${HOME}/bin to your $PATH. If you are using bash, add this to ~/.bashrc:
export PATH="${HOME}/bin:${PATH}"
You can do that using echo:
echo 'export PATH="${HOME}/bin:${PATH}"' >> ~/.bashrc

how to install nodejs 0.10.26 from binaries in Ubuntu

I am new to linux and am trying to install nodejs latest version with binaries. The solutions I have looked up suggest the installation using apt-get on some private repositories(PPA), which I do not want to do.
So I ran the following commands:
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz
tar -zxvf node-v0.10.26-linux-x64.tar.gz
mv node-v0.10.26-linux-x64 node-v0.10.26
sudo cp -r node-v0.10.26 /usr/local/src
After this, I don't really know what to do. I read an article which suggested created symbolic links, which I am kind of scared to mess up with without knowing the details.
Could you please give me a set of commands to run after this in order to install node with npm? I guess npm should be a part of this binary version.
The best way to install Node.js and have the latest version (or any other version that you prefer, be it LTS or "current") is to download the official binary bundle and uncompress it. A neat way to do it:
# Use version 0.10.26
$ NODE_VERSION="v0.10.26"
# To use a newer version, for example 6.10.3, use instead:
$ NODE_VERSION="v6.10.3"
$ curl -LO http://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz
$ tar xzf node-$NODE_VERSION-linux-x64.tar.gz
$ sudo cp -rp node-$NODE_VERSION-linux-x64 /usr/local/
$ sudo ln -s /usr/local/node-$NODE_VERSION-linux-x64 /usr/local/node
The basic idea is to move all the contents of the archive into /usr/local, then create a symlink in /usr/local/node pointing to the most recent version.
For enabling the use of the "node" executable from the command line without referencing the full path (/usr/local/node/bin/node), add /usr/local/node/bin to your $PATH (usually this involves altering the ~/.bash_profile or ~/.profile file; there's plenty of docs for how to do this).
If you need to update Node.js (suppose it's version 7.10.0), then, just extract the tarball in /usr/local and update the symbolic link so it points to the new one. You can then optionally remove the old folder.
May 2017 update
As of the "Creators Update", the commands above can now work also on Windows 10 using the "Windows Subsystem for Linux" (via bash). On Ubuntu on Windows 10, after creating the symlink like above, to add the folder to your $PATH add PATH="/usr/local/node/bin:$PATH" in the ~/.bashrc file.
I combined both of these answers for my docker container. I wanted the executable to be in the PATH already without me explicitly doing that.
#!/usr/bin/env bash
install_node() {
NODE_VERSION="v8.3.0"
curl -# "http://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" | tar -xz
cp -pr "node-${NODE_VERSION}-linux-x64" "/usr/local/"
ln -s "/usr/local/node-${NODE_VERSION}-linux-x64" "/usr/local/node"
ln -s /usr/local/node/bin/* "/usr/local/bin"
rm -rf "node-${NODE_VERSION}-linux-x64"
}
install_node
You can extract the binary anywhere and use update-alternatives command which maintain symbolic links determining default commands for example this is on my laptop.
first i extract my node node-v10.16.3-linux-x64.tar.xz on /mnt/e/WSL_Ubuntu/Downloads/node-v10.16.3-linux-x64/ folder :
xxxx#xxxxPC:.../WSL_Ubuntu/Downloads$ tar xvf node-v10.16.3-linux-x64.tar.xz
xxxx#xxxxPC:.../WSL_Ubuntu/Downloads$ cd node-v10.16.3-linux-x64/
then update-alternatives --install :
xxxx#xxxxPC:.../node-v10.16.3-linux-x64/bin$ sudo update-alternatives --install /home/wira/.local/bin/node node\
> /mnt/e/WSL_Ubuntu/Downloads/node-v10.16.3-linux-x64/bin/node 60
update-alternatives: using /mnt/e/WSL_Ubuntu/Downloads/node-v10.16.3-linux-x64/bin/node to provide /home/wira/.local/bin/node (node) in auto mode
Now i use the node on terminal
xxxx#xxxxPC:.../node-v10.16.3-linux-x64/bin$ node --version
v10.16.3
You should also update-alternatives --install on npm binaries.
I think there is still a cleaner way
NODE_VERSION="v6.7.0"
# Download
curl -LO http://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz
# uncompress
tar xzf node-$NODE_VERSION-linux-x64.tar.gz
# selective copy
cp -R ./node-$NODE_VERSION-linux-x64/bin/* /usr/local/bin
cp -R ./node-$NODE_VERSION-linux-x64/lib/* /usr/local/lib
cp -R ./node-$NODE_VERSION-linux-x64/include/* /usr/local/include
cp -R ./node-$NODE_VERSION-linux-x64/share/* /usr/local/share
Node should be working now
$ node -e 'console.log("HI")'
HI
Hope it helps

How to install node binary distribution files on Linux

My production server (Centos 5.9) won't compile nodejs, possibly because it's gcc is only 4.1.2 (4.2 or above is recommended) so I've trying to install the binaries.
$ wget http://nodejs.org/dist/v0.10.22/node-v0.10.22-linux-x86.tar.gz
$ tar -zxvf node-v0.10.22-linux-x86.tar.gz
$ cd node-v0.10.22-linux-x86
$ sudo cp bin/* /usr/local/bin
$ sudo cp -R lib/* /usr/local/lib
$ sudo cp -R share/* /usr/local/share
And now for testing:
$ node -v # => v0.10.22
$ man node # looks fine
$ npm -v # UH OH, PROBLEM - Cannot find module 'npmlog'
Now (keeping in mind I'm a complete beginner at node) I did some searching and found there's an environment variable called NODE_PATH, so I tried:
$ export NODE_PATH=/usr/local/lib/node_modules
$ npm -v # SAME PROBLEM - Cannot find module 'npmlog'
So then I found out where npmlog lives and tried modifying NODE_PATH accordingly:
$ find /usr/local/lib -name npmlog # => /usr/local/lib/node_modules/npm/node_modules/npmlog
$ export NODE_PATH=/usr/local/lib/node_modules/npm/node_modules
$ npm -v # DIFFERENT PROBLEM - Can't find '../lib/npm.js'
At this stage, after more unhelpful googling, I decided I was in over my depth and decided to ask for help. Can anyone tell me what I'm doing wrong?
It is much faster to do clean NPM reinstall which will remove "broken" links:
wget https://npmjs.org/install.sh
chmod +x install.sh
sudo ./install.sh
Then it will ask you to remove old NPM link
Using Node Version Manager
Use a Node version manager like nvm to handle installation and version management for you. After you install nvm you can simply install any Node version, for example nvm install 8.
But if you just want to install the binary yourself, see below:
Using apt-get
In special cases where you need a system wide Node installation, you can use apt-get:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
The above snippet will install the latest Node 8.
Installing the Binary Manually
In order to install the binary manually, all you need to do is to download the binary and create a bunch of symbolic links. Execute the commands below one after the other, and it should do the job. I have also written a shell script that does it for you if that is easier (see the bottom of the answer). Hope that helps.
Make sure to use the correct download link for your OS architecture (i.e. either 32-bit or 64-bit) for wget on the second line.
ME=$(whoami) ; sudo chown -R $ME /usr/local && cd /usr/local/bin #adding yourself to the group to access /usr/local/bin
mkdir _node && cd $_ && wget https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz -O - | tar zxf - --strip-components=1
ln -s "/usr/local/bin/_node/bin/node" .. # Making the symbolic link to node
ln -s "/usr/local/bin/_node/lib/node_modules/npm/bin/npm-cli.js" ../npm ## making the symbolic link to npm
Here is a shell script that downloads and installs all the components. If you use this script to install Node, you can use the uninstall script to uninstall it.
Installing Node
#! /bin/bash
# run it by: bash install-node.sh
read -p " which version of Node do you need to install: for example 8.11.4 (or any other valid version): " VERSIONNAME
read -p " Are you using a 32-bit or 64-bit operating system ? Enter 64 or 32: " ARCHVALUE
if [[ $ARCHVALUE = 32 ]]
then
printf "user put in 32 \n"
ARCHVALUE=86
URL=https://nodejs.org/dist/v${VERSIONNAME}/node-v${VERSIONNAME}-linux-x${ARCHVALUE}.tar.gz
elif [[ $ARCHVALUE = 64 ]]
then
printf "user put in 64 \n"
ARCHVALUE=64
URL=https://nodejs.org/dist/v${VERSIONNAME}/node-v${VERSIONNAME}-linux-x${ARCHVALUE}.tar.gz
else
printf "invalid input expted either 32 or 64 as input, quitting ... \n"
exit
fi
# setting up the folders and the the symbolic links
printf $URL"\n"
ME=$(whoami) ; sudo chown -R $ME /usr/local && cd /usr/local/bin #adding yourself to the group to access /usr/local/bin
mkdir _node && cd $_ && wget $URL -O - | tar zxf - --strip-components=1 # downloads and unzips the content to _node
cp -r ./lib/node_modules/ /usr/local/lib/ # copy the node modules folder to the /lib/ folder
cp -r ./include/node /usr/local/include/ # copy the /include/node folder to /usr/local/include folder
mkdir /usr/local/man/man1 # create the man folder
cp ./share/man/man1/node.1 /usr/local/man/man1/ # copy the man file
cp bin/node /usr/local/bin/ # copy node to the bin folder
ln -s "/usr/local/lib/node_modules/npm/bin/npm-cli.js" ../npm ## making the symbolic link to npm
# print the version of node and npm
node -v
npm -v
Uninstalling Node
#! /bin/bash
# run it by: ./uninstall-node.sh
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/lib/node_modules/
sudo rm -rf /usr/local/include/node/
sudo rm -rf /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/bin/_node/
I had a problem like that, but with iojs. However it should be the same procedure:
(Assuming that you've got a file matching node-v*-linux-x64.tar.gz in your current directory):
# In case of iojs you need to replace the occurrences of 'node' with 'iojs'
# Extract the downloaded archive with the linux-x64 version of node
tar zxf node-v*-linux-x64.tar.gz
# Move the extracted folder (./node-v*-linux-x64/) to /opt/
mv ./node-v*-linux-x64/ /opt/
To make the binary files available in your shell, create some softlinks inside the /usr/bin/ directory:
# Create a softlink to node in /usr/bin/
ln -s /opt/node-v*-linux-x64/bin/node /usr/bin/node
# Create a softlink to npm in /usr/bin/
ln -s /opt/node-v*-linux-x64/bin/npm /usr/bin/npm
# Create a softlink to iojs in /usr/bin (this step can be omitted if you're using node)
ln -s /opt/node-v*-linux-x64/bin/iojs /usr/bin/iojs
Notice: If you'd like to access the cli of some globally installed node modules (for example bower, typescript or coffee-script), you're required to create a softlink to each of those executables in the /usr/bin/ directory.
Alternatively you could just add the bin directory of your node installation directory (e.g. /opt/node-v*-linux-x64/) to the PATH environment variable: (you should use the absolute path for this!)
# create a new .sh script in /etc/profile.d which adds the directory to PATH
echo "export PATH=$PATH:/opt/node-v0.12.3-linux-x64/bin" > /etc/profile.d/node-npm.sh
This change will take effect after logging out and in again.
Both methods worked for me (I use a linux desktop version of Ubuntu 14.04/15.04 with GNOME 3).
I had the same issue reported here. Fixed it by removing /usr/local/bin/npm and replacing it with a symlink to /usr/local/lib/node_modules/npm/bin/npm-cli.js
$ ls -l /usr/local/bin/
node
npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
$ npm -v
1.3.17
wget <node archive url from nodejs.org>
cd /usr/local
sudo tar --strip-components 1 -xf <path to node archive>
You can run node and npm right away.
It used to be documented in the README inside the archive in older versions.
I had the same problem and I was able to resolve it by creating symlinks instead of copying the binaries.
$ cd /usr/local/src
$ wget http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-x64.tar.gz
$ tar -zxvf node-v0.10.24-linux-x64.tar.gz
$ cd node-v0.10.24-linux-x64
$ sudo cp -R lib/* /usr/local/lib
$ sudo cp -R share/* /usr/local/share
$ ln -s /usr/local/src/node-v0.10.24-linux-x64/bin/node /usr/local/bin/node
$ ln -s /usr/local/src/node-v0.10.24-linux-x64/bin/npm /usr/local/bin/npm
$ node -v
v0.10.24
$ npm -v
1.3.21
I tend to use nave to install the binaries. Use wget to download the nave.sh file and then us it to install node. Nave is also nice to have around in case one of your production apps requires a different version of node than what's installed globally.
$ wget https://raw.github.com/isaacs/nave/master/nave.sh
$ sudo bash nave.sh usemain 0.10.22
You can use GNU stow to make symbolic links of those binaries in /usr/local properly with one command. Stow also allows you to easily remove Node js from /usr/local at a later time and swap multiple versions of Node js.
$ # first, install stow
$ mkdir /usr/local/stow # if it doesn't exist
$ # then, place software binary package in /usr/local/stow
$ cd /usr/local/stow
$ stow <package_name> # install / add sym links
$ source $HOME/.bash_profile # reload your environment
$ # node -v and npm -v should now work
$ stow -D <package_name> # uninstall / remove sym links
These steps worked for me with node-v0.10.17-linux-x64.
In the man page of cp in Mac OS X:
Symbolic links are always followed unless the -R flag is set, in which case symbolic links are not followed, by default.
When you execute sudo cp bin/* /usr/local/bin, the symbolic link bin/npm is followed.
Actually, bin/npm is linked to ../lib/node_modules/npm/bin/npm-cli.js, so cp will copy npm-cli.js to /usr/local/bin. That's why you get an error.
I had the same problem.
The problem is the npm excutable in /usr/local/bin.
The way I solved it was:
sudo rm /usr/local/bin/npm
sudo ln -s "/usr/local/lib/node_modules/npm/bin/npm-cli.js" /usr/local/bin/npm
In Ubuntu there is a .bashrc file which sets path to binaries.
By default, there is path set for bin in home directory. Perhaps you can create bin directory in your home directory and move the binaries there. Reboot your system and try executing the command node
I faced the same problem. So, I symlinked node and npm from ./bin/ to /usr/local/bin
If someone is interested in using Docker, in the Dockerfile,
ENV NODE_VERSION 8.10.0
RUN wget https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz
RUN tar -xJvf node-v$NODE_VERSION-linux-x64.tar.xz -C /usr/local/
ENV NODEJS_HOME /usr/local/node-v$NODE_VERSION-linux-x64
ENV PATH $NODEJS_HOME/bin:$PATH
RUN node --version
RUN npm --version

rpmbuild spec file %install section error

I have a spec file which is similar to:
BuildRoot: /tmp/build_%{name}-%{version}-%{release}
%prep
...
...
%install
# Directories
install -m 755 -d %{buildroot}/usr/app/mypackage/config
install -m 755 -d %{buildroot}/usr/app/mypackage/src
....
# Bash script
install -m 755 script/script1.sh %{buildroot}/usr/app/mypackage/config/script1.sh
install -m 755 script/script2.sh %{buildroot}/usr/app/mypackage/config/script2.sh
install -m 755 script/myapp-log %{buildroot}/etc/logrotate.d/myapp-log
When I run the rpmbuild I get the error:
install: cannot create regular file `/tmp/build_my_app-1.0-2/etc/logrotate.d/myapp-log'
I can get around this by manually creating the /etc/ and then /etc/logrotate.d directories in the /tmp/build_my_app-1.0-2/ directory.
When I re-reun the rpmbuild it will work.
I guess this is because I am not creating this directory in my install section but as its not directly related to my application I don't want to put that in.
My guess is that there is some clever tag I can use to fix this so that the build will work without any manual intervention.
My Question:
Could someone please suggest a way for me to achieve this (assuming its possible) or whether I need to write a script around the rpmbuild to set this up first.
You are missing the step to create the installation directories in your %install section. Remember that since you can build in "different" roots, you cannot expect certain directories (like ${buildroot}/etc) to be present.
Try adding
mkdir -p ${buildroot}/etc/logrotate.d
just before the install command that copies the file into ${buildroot}/etc/logrotate.d.

Resources