Nginx - Building from source - not working - linux

I was using this code to install Nginx
aptitude -y install nginx
aptitude -y full-upgrade
This was working fine. However, I want to install my apps from source to give me more control. I then used this code:
cd /opt/
wget http://nginx.org/download/nginx-1.2.3.tar.gz
tar xvfz nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure
make
make install
However, it seems to have extracted and installed fine on the server, but I cant see anything on my site. The command used to restart my Nginx also no longer works:
/etc/init.d/nginx restart
Is anyone able to give me a bit more information on what might be going wrong?

You need to check, where the server was installed. Probably it was installed to the /usr/local/bin directory. And the binary, that it specified in /etc/init.d/nginx is in /usr/bin.
Also, you can add set -x as the second line in the /etc/init.d/nginx to see what happens when you start it.

Related

Install node.js on dedicated server via ssh

I own a dedicated linux server from 1&1. I have SFTP and SSH access. I would like to know if it is possible to install node.js on my server.
I already tried to install it one week ago but I failed. The downloading and extraction worked, so the folder is on my server. I did :
cd ~
wget http://nodejs.org/dist/latest/node-v11.1.0.tar.gz
tar xvf node-v11.1.0.tar.gz
mv node-v11.1.0 nodejs
But this part failed :
cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm
On the first instruction, there is an error : cp : cannot stat 'nodejs/bin/node': No such file or directory
I tried this too :
cd nodejs
./configure
make
make install
(All instructions are from tutorials)
The instructions are you following are for a precompiled bundle for Linux.
http://nodejs.org/dist/latest/node-v11.1.0.tar.gz is the URL to a source code bundle.
Download the compiled bundle for your system instead.
Your best bet may be to look for distribution-specific instructions. Most modern package managers will have an install option for Node and there are great options 3rd parties like Nodesource as well.
For instance, here's a DO howto for installing on Ubuntu 18.04. It lists 3 different methods for install, each of which would work from an SSH session.
If you let us know what distribution and version you are running, we may be able to help you more specifically.
If you don't know, you can try one of these commands to check:
$ hostnamectl
or
$ less /etc/issue

Reset Realm Object Server on Linux

Can I ask that are there any scripts in Linux that similar to reset-server-realms.command on Mac that can delete all realms on server. Actually I need to reset the server and clean it before use the application officially. I try to uninstall regarding to the guides on Realm website but somehow the old data still comes up.
Thanks
Uninstalling the package doesn't remove any data. This is done on purpose, so that the upgrade process of RPMs and debs works properly.
We don't provide a script, but the easiest way to wipe everything is simply to run:
sudo rm -rf /var/lib/realm
# CentOS
sudo yum remove realm-object-server-de
sudo yum install realm-object-server-de
# Ubuntu
sudo apt-get install --reinstall realm-object-server-de
Please note that this will preserve your configuration, still. The configuration is stored in /etc/realm.

Python3.X.X Proper Setup with Virtualenv and multiple installs to /OPT/

I have spent about a week trying to get python python 3.x.x setup “properly” on my system. It has been quite a battle and I'm just about there with one final obstacle I can't seem to resolve. Many forums discuss setting up Python 3.X.X on various distro's and each has different methods, goals, outcomes, errors/issues with no clear answer. By now I have put in over 100 hours and have busted/reinstalled my system with clonzilla images dozens to times. But after all that, I have captured all the steps necessary to have the ultimate python setup in this posting - minus the answer to the final obstacle which I'm hoping someone can help me with:
The end goal I'm aiming for is the “ultimate python3.x.x setup” that I define as having the following characteristics:
has clean installation/configurations of python3.x.x. that are built from source, and include multiple side-by-side python3.x.x. versions (e.g. python3.0.1, python3.2.5, python3.3.0) with preserved root permissions assigned to each folder as part of the default /opt/ directory
Each installation does not interfere with the system's default interpreter,has pip, easy install, distribute tools, and virtualenv all properly configured and working and can run in isolation with different modules via virtualenv's
each python3.x.x is compiled, installed and named clearly in the /opt/ directory (e.g. python3.3.0, python3.3.1, python3.3.2), and is configured such that when calling whatever python3.x.x from the terminal window or using that version that it does not screwup the system's default interpretor, its dependencies/packages (plenty of forums on this one)
Each python3.x.x is working in pycharm's stupidly simplistic and awesome virtualenv manager - my last hurdle
The following steps are my setup so far and it compiled from multiple forums necessary to accomplish all of the above minus the last hurdle. Two important points are 1) I'm running Linux Mint LTS 13 and 2) I have NOT ran “sudo apt-get install python3” or any similar apt-get of python3xxxxx (this is deliberate for reasons below).
These are the steps I have taken on a fresh install of Linux mint 13, and now have backed up clonezilla image as well as virtual box's which I'm now using to solve this last hurdle.
Step 1:
This mega-command will download and setup pycharm, including the program's oracle (sun) dependencies, and install everything to the /opt/ directory (i.e.the proper location). I simply accept oracle's prompts and complete pycharm's final installation prompts (e.g. accept license, trial period etc.)
Pycharm
sudo add-apt-repository ppa:webupd8team/java -y && sudo apt-get update && sudo apt-get install oracle-java7-set-default -y && sudo apt-get install oracle-java7-installer -y && wget "http://download.jetbrains.com/python/pycharm-professional-3.0.2.tar.gz" && sudo mkdir /opt/Pycharm && sudo cp pycharm-professional-3.0.2.tar.gz /opt/Pycharm/ && cd /opt/Pycharm/ && sudo tar xvfz pycharm-professional-3.0.2.tar.gz && cd pycharm-3.0.2/bin && sudo sh pycharm.sh
Step 2:
This single command will download, extract, move, compile, and install 3.3.0, with all necessary prior dependencies, and place python3.3.0 in the /opt/ directory (the proper location).
Python3.3.0
sudo apt-get install build-essential libbz2-dev bzip2 zlib1g-dev sqlite3 libsqlite3-dev -y && wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz && tar xvfz Python-3.3.0.tgz && cd Python-3.3.0 && ./configure --prefix=/opt/python3.3.0 && make && sudo make install
Step 3:
This single command will download, extract, move, compile, and install 3.2.5, with all necessary dependencies, and place python3.2.5 in the /opt/ directory.
Python3.2.5
wget http://www.python.org/ftp/python/3.2.5/Python-3.2.5.tgz && tar xvfz Python-3.2.5.tgz && cd Python-3.2.5 && ./configure --prefix=/opt/python3.2.5 && make && sudo make install
We now have pycharm and two side-by-side installations of python3.3.0 and python3.2.5 that are built from source, installed in the /opt/directory, and will not interfere with the system's python2.x.x interpretor or its dependencies/packages. Good so far as this is a very clean setup... Now comes the final hurdle.
If I (or you) “sudo apt-get install python3-dev” from this point, including a few other commands to setup and activate a virtualenv of python3.x.x, everything appears to work. Meaning you can setup multiple Python3.x.x virtualenv's and run them with pycharm, eclipse or from a terminal windows as either virtualenv's or non-virtualenv's. Pycharm makes it stupidly easy to manage virtually any configuration you want with its built-in virtualenv manager. The problem though is that doing “sudo apt-get install python3-dev” defeats the whole purpose of keeping python3.x.x as separate installations and runs the risk of 1) breaking python2.x.x packages, 2) installs pip packages meant for python3.x.x. into python2.x.x directories, 3) limits the ability of the user to only python3.2 and lower because you have to point whatever virtualenv you're using to the interpreter that came with running “sudo apt-get install python3-dev”, 4) a plethora of other problems scattered throughout forums I have investigated this this week in trying to figure this all out. Therefore “sudo apt-get install python3-dev” or any other apt-get of python3.x.x is not a solution as it leads to too many issues.
At this point I have a master version of a virtual box image setup with all the above steps completed in which I keep cloning and retrying to get the compiled interpretorls from /opt/ to function without doing a “sudo apt-get python3.xxx”. The 'key problem' indicated in screen shot is this issue. Nothing I do seems to allow me to point it to /opt/python3.xx/bin/pythonX interpretor whether using an IDE like pycharm, eclipse or by terminal. As soon as I run “sudo apt-get python3.xxx” it will work – but of course inherit all the other nightmare that people scream about in forums when they go down that route. Any help is greatly appreciated...
screenshot http://www.pasteall.org/pic/show.php?id=65653
Every configuration I have tried in getting the interpretor's that were compiled from source fails to allow those python3.x.x installations to function as virtualenv's and thus use package managers like pip either in a terminal window or with pycharm/eclipse. I have tried installing to home directories, changing permissions in /opt/, making system links, practically everything - everything that doesn't involve a “sudo apt-get install python3.xxxx”...This post (https://askubuntu.com/questions/406756/how-to-install-python-3-x-x-properly#406762), at step two, works but only if you revert to doing a “sudo apt-get install python3”.
What you're looking for is pyenv. It will manage your python installations, and allow you to install new versions of python without hampering other installations, it will work fine Pycharm, and will not hamper other python installations. Its done completely in bash, so it does not have python as a prerequisite installation.
I have finally figured out what I was doing wrong. I was not reading the make report and fixing additional dependencies before installing. The main problem was including dependencies for _ssl which is required for pip to work with python3.
I now have my "ultimate python setup"

Jenkins failed to start in linux

go to run jenkins after doing an upgrade, and get the following:
start jenkins
start: Job failed to start
That's it...nothing shows up in jenkin's log...so it is difficult to debug to say the least.
(and it isn't running already, or anything like that).
Is there another log somewhere that I should be looking at that would be helpful?
(I am assuming answer to this problem will be somewhat iterative, so hopefully someone can start me on a path to debug this)
So, knowing it was a pre-start error allowed me to investigate more deeply.
Further digging allowed me to figure out that the exact line in the /etc/init/jenkins.conf file was one pointing to the /usr/share/jenkins/bin/maintain-plugins.sh
Looking at this location, I found it was not present (ie. no bin directory). This means that jenkins-common was no longer installed for some reason...odd indeed...going into apt-get and doing an install of this component again led to the error:
dpkg error processing /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb ...
having seen this error before and refreshing my memory via google gave the following solution:
dpkg -i --force-overwrite /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb
This allowed the installation of common to proceed as normal. After this, all I had to do was replace the /usr/share/jenkins/jenkins.war with my backed up copy (because ubuntu is far behind the latest release version), and I was able to start the server again.
I am not exactly sure what caused the problem to begin with, but it was likely during an apt-get upgrade/clean process...and because of the weirdness with jenkins conflicting with jenkins-common, it did not repopulate the /usr/share/jenkins directory properly.
regardless, am glad it is working again. :)
Instead, you can run the following before the install to properly clean up any conffiles left by the distro version:
sudo apt-get purge jenkins
Then install the correct version.
Ubuntu 18.04 LTS use Java 9 as default java
Jenkins 2.107.2 still use Java 8
[Solution]
Install Java 8 before install Jenkins
sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
sudo apt install jenkins
See https://stackoverflow.com/a/49937744/900684
I went to see the jenkins logs
tail -f /var/log/jenkins/jenkins.log
In my case it didn't start because I used incompatible java version.
Update and make sure it sees correct java (In my case it should have been opened using JRE 1.7. To check, please use java -version command) and all should work
The following worked for me:
sudo rm /etc/init/jenkins.conf
sudo update-rc.d jenkins defaults
sudo service jenkins start
Then....
root#core:/# service jenkins start
* Starting Jenkins Continuous Integration Server jenkins [ OK ]
Borrowed from: https://groups.google.com/forum/#!msg/jenkinsci-users/eW_yEWLojFc/tFhb8DKoRHUJ
I got from this link: https://serverfault.com/questions/710680/jenkins-not-starting-in-ubuntu
It might be caused by a full disk.
To be really sure, try running it manually. Like this:
/usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

How to create terminal commands for programs installed from source

I recently tried to install monit on Ubuntu Natty from source. Here's my code:
apt-get -y install openssl libssl-dev bison flex
mkdir src && cd src
wget http://mmonit.com/monit/dist/monit-5.3.2.tar.gz
tar xzf monit-5.3.2.tar.gz
cd monit-5.3.2
./configure --prefix=/usr/local/monit
make && make install
However, when I install Monit using apt-get I am able to call monit directly from the command line using the keyword monit. I am not able to do so when I do the install from source. The same goes for PHP.
How can I enable this feature for when I install Monit (and other Linux programs) from source?
Thanks in advance.
EDIT
I was able to solve this by doing the following:
printf "\nPATH=/usr/local/monit/bin:\${PATH}\n" >> ~/.profile
source ~/.profile
This will apply for the currently logged in user (in my case root). To make it system-wide simply replace ~/.profile with /etc/profile.
So now I can can call monit (and any other program I install from source).
Using that command to install it will put it in /usr/local/monit, which won't be in your $PATH, as others have said. There are several options besides modifying your path, though. For instance, you can create a symbolic link from the real executable to one in your path. So if the executable is /usr/local/monit/monit, you can
ln -s /usr/local/monit/monit /usr/local/bin/monit
The advantage of creating the symbolic link is it will work for all users.
You can also create an alias, but that would only work for apps that run as you.
Edit your /etc/profile to add the path /usr/local/monit to the PATH variable.
For ex, if you earlier had this.
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
You could change it to
PATH="/usr/local/monit:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"

Resources