Changing default port for Jenkins doesn't work (MAC) - macos

I tried a lot of ways to do it, but no one helped.
I installed Jenkins with homebrew.
Run it by the command:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
I tried:
sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 9999
But there is no file 'org.jenkins-ci'. So I created and tried again this command... Restart Jenkins... Didn't help!

I think the Jenkins installed by homebrew has its options in:
~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
so you would need to edit that and the relaunch. Note that, if you can't see your Library directory inside your Home directory in the Finder, you can type Cmd+Shift+G and type ~/Library.

Related

Updating Anaconda fails: Environment Not Writable Error

I'm trying to update Anaconda and its packages using conda update --name root conda, but it fails every time.
Error message : EnvironmentNotWritableError: The current user does not
have write permissions to the target environment. environment
location: C:\ProgramData\Anaconda3
Environment location: C:\ProgramData\Anaconda3. I replaced the root with base, still I get the same error.
Any help?
start your command prompt with run as administrator
If you face this issue in Linux, one of the common reasons can be that the folder "anaconda3" or "anaconda2" has root ownership. This prevents other users from writing into the folder.
This can be resolved by changing the ownership of the folder from root to "USER" by running the command:
sudo chown -R $USER:$USER anaconda3
or sudo chown -R $USER:$USER <path of anaconda 3/2 folder>
Note: How to figure out whether a folder has root ownership?
-- There will be a lock symbol on the top right corner of the respective folder.
Or right-click on the folder->properties and you will be able to see the owner details
The -R argument lets the $USER access all the folders and files within the folder anaconda3 or anaconda2 or any respective folder. It stands for "recursive".
On Windows, search for Anaconda PowerShell Prompt. Right click the program and select Run as administrator. In the command prompt, execute the following command:
conda update -n base -c defaults conda
Your Anaconda should now update without admin related errors.
Open this folder "C:\ProgramData\" and right-click on "\Anaconda3". go to properties -> security and check all the boxes for each user. This worked for me.
If you get this error under Linux when running conda using sudo, you might be suffering from bug #7267:
When logging in as non-root user via sudo, e.g. by:
sudo -u myuser -i
conda seems to assume that it is run as root and raises an error.
The only known workaround seems to be: Add the following line to your ~/.bashrc:
unset SUDO_UID SUDO_GID SUDO_USER
...or unset the ENV variables by running the line in a different way before running conda.
If you mistakenly installed anaconda/miniconda as root/via sudo this can also lead to the same error, then you might want to do the following:
sudo chown -R username /path/to/anaconda3
Tested with conda 4.6.14.
I had installed anaconda via the system installer on OS X in the past, which created a ~/.conda/environments.txt owned by root. Conda could not modify this file, hence the error.
To fix this issue, I changed the ownership of that directory and file to my username:
sudo chown -R $USER ~/.conda
On Windows in general, running command prompt with administrator works. But if you don't want to do that every time, specify Full control permissions of your user (or simply all users) on Anaconda3 directory. Be aware that specifying it for all users allows other users to install their own packages and modify the content.
I had the same issue and the base environment was in C:\ProgramData\Anaconda3. This is the case, when Anaconda is installed for all users.
As a solution, I re-installed Anaconda just for me and now the base environment is in \AppData\Local\Continuum\anaconda3. This now can be updated via conda update without admin privileges.
As an alternative, I would suggest looking at your conda config file.
Reason
Sometimes for creating a virtual env at a specified location other than the pre-defined path at ~/anaconda3/envs we append the conda config file using: conda config --append envs_dirs /path/to/envs where envs_dirs is a specified function in config file for allocating different paths where conda can find your virtual envs. Removing a recently added path in this config file may solve the problem.
Solution
$:> conda config --show envs_dirs
envs_dirs:
- /home/some_recent_path # remove this
- /home/.../anaconda3/envs
Note the value specifing a different directory other than the predefined location, and remove it using
$:> conda config --remove envs_dirs /home/some_recent_path
Now the config file envs_dirs is set to default location of envs. Try creating a new env now.
this line of code on your terminal, solves the problem
$ sudo chown -R $USER:$USER anaconda 3
WINDOWS:
I also got following error while (base) PS E:\Python> conda install ConfigParser
Verifying transaction: failed
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:\ProgramData\Anaconda3
My solution: Open Command prompt as administrator, then above command again and it worked.
C:\WINDOWS\system32>conda install ConfigParser
Collecting package metadata (current_repodata.json): done Solving environment: done
Package Plan
environment location: C:\ProgramData\Anaconda3
added / updated specs:
- configparser
The following NEW packages will be INSTALLED:
configparser pkgs/main/noarch::configparser-5.0.2-pyhd3eb1b0_0
Proceed ([y]/n)? y
Preparing transaction: done Verifying transaction: done Executing
transaction: done
I had the same problem. The cause for me was that when downloading Anaconda, I chose 'download for all users' instead of 'just for me'. I uninstalled it, re-installed it and corrected that. And I'm not getting this error anymore.
On Windows,
Create a new environment with
conda create --name py35 python=3.5
see conda cheat sheet
Activate this environment
activate py35
Now you don't need to have root access to your new environment.
As mentioned in a comment to the accepted answer, the default environment base requires administrative rights on Windows:
On Windows, if you're trying to install packages into the base
environment (which is installed to C:\ProgramData\Anaconda3), you'll
need admin access. If you first create an environment (which should
install in your user directory under .conda\envs) and activate it, you
no longer need admin right for that environment. Don't forget to
activate the env after creating it. – C.J. Jackson
In my case somehow CONDA_ENVS_PATH was removed, so I was having NotWritableError. So I fixed the error by specifying
CONDA_ENVS_PATH=~/my-envs:/opt/anaconda/envs
in the .bashrc file
I was also suffered by same problem. I resolved the problem by reinstalling anaconda(While installation at this time I selected "just for me" as user) and my problem was solved.Try the same
CONDA UPDATE - NO WRITE ACCESS PROBLEM ## FIXED##
SIMPLE SOLUTION:
Press the Windows+S combination button and type "cmd" into it.
Right click on the Command Prompt App result that shows up and click on "Run as administrator"
Now, in the black window that is open (i.e. your Command prompt), copy and paste the following to check for your version: conda --version
If you want the latest update, then update Conda by running the update command by pasting the following and clicking enter in the command prompt(black window):
conda update conda
If a newer version is available, it will prompt you for a yes/no to install the update. Type "yes" and then press Enter to update.
Deleting file .condarc (eg./root/.condarc) in the user's home directory before installation, resolved the issue.

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Unable to set "mongod" PATH

I'm having issues trying to run mongod upon terminal start up.
OS
OSX 10.11.4
Steps so far:
Download OS X 10.7+ 64-bit
Uncompress mongodb-osx-x86_64-3.2.5.tgz
Rename mongodb-osx-x86_64-3.2.5 to mongodb
Moved /mongodb to [Desktop/development]
Add /data/db to Desktop/development/mongodb/bin
Changed permissions to /data/db using chmod 777 /data/db
Within Desktop/development/mongod/bin typing ./mongod everything is working as expected and I can access the the mongo shell. Now I would like to just be able to type mongod upon terminal startup and run both mongo and mongod
PATH for mongod
Open bash file vi ~/.bashrc
While in insert mode: export PATH=Desktop/development/mongodb/bin:$PATH I've also tried export PATH=$Home/Desktop/development/mongodb/bin:$PATH
What am I missing or doing wrong?
Thanks
EDIT
As per suggestions I've moved all the mongo files into a more appropriate locations.
Mongo location: $HOME/mongodb/bin
Mongo DB location: $HOME/mongoData
Data/db location: $HOME/mongoData/data/db
Bash command: export PATH=$HOME/mongodb/bin:$PATH
I'm thinking this is correct, but still unable to run mongod is there something missing in the bash command? Like mongo = PATH=...?
Desktop is actually $HOME/Desktop as it's in your home directory, so you need:
export PATH=$HOME/Desktop/development/mongodb/bin:$PATH
Desktop is not the place to put stuff as it's nothing much more than a convenience area that you can add to and remove from at a whim. It's also too visible as you will see the folder icons.
You should have installed all that stuff into your home directory (or /usr/local if you want it available to all users).
Also "Add /data/db to Desktop/development/mongodb/bin" doesn't look right to me as data and executables are different.
If I was adding mongodb for development then I would have installed it via Macports with:
$ sudo port install mongodb
and would be up and working in less than 2 minutes.

How to Create a configuration File For MongoDB

I have installed mongodb for mac os through 10gen and I have gone through the documentation to do so. Everything seems fine apart from the configuration file. I can not see it in /etc/mongod.config. Do I have to manually create this config file? And if so how can I go about it?
cheers
The default path for brew installed mongodb on Mac OS X is /usr/local/etc/mongod.conf
Unless you have installed a packaged version of MongoDB (for example, using Homebrew or Mac Ports) you will have to create a config file manually, or just pass the appropriate command line parameters when starting up MongoDB.
If you want a commented example of a config file to start with, the mongodb.conf in the Debian/Ubuntu package should be a good starting point. Important options to check are the dbpath and logpath which will likely be different for you.
It would also be worth looking at the Homebrew mongodb formula which includes setting up a LaunchAgent script to manage the mongod service.
Yes, unless you install via a package manager (like apt or yum on Linux) you have to create this manually. Then, When you start mongod you simply need to specify where the config file is, for example:
./mongod -f /path/to/mongod.conf
For how that file should look, just take a look here:
http://docs.mongodb.org/manual/reference/configuration-options/
You can also see the aforementioned Linux config files from the packages on github:
https://github.com/mongodb/mongo/blob/master/rpm/mongod.conf
https://github.com/mongodb/mongo/blob/master/debian/mongodb.conf
In the case you installed MongoDB without Homebrew, i.e. downloaded the TGZ package directly from MongoDB Download Center, you will can add the configuration file:
sudo nano /etc/mongod.conf
Please use only spaces (no tabs) in the file and leave a space after the key. For example:
security:
authorization: enabled
net:
port: 27017
bindIp: 0.0.0.0
And then run the instance with the configuration flag:
mongod -f /etc/mongod.conf
I wrote a post about installing MongoDB Community Edition directly from the TGZ archive.

MacPorts Installation -- Shell Commands/Postflight Script

I had run the MacPorts installer (2.0.3) for my OS X Leopard (10.5.8) which finished "successfully". Unfortunately the port command was not available so I looked in the MacPorts Guide which says that the installer should have run a so-called "postflight" script that sets the necessary environment variables. I tried to run the postflight script manually (which I downloaded from here), but the execution fails with the following output:
Detected the bash shell.
Your shell already has the right PATH environment variable for use with
MacPorts!
Your shell already has the right MANPATH environment variable for use with
MacPorts!
Your shell already has the right DISPLAY environment variable for use with
MacPorts!
Adding [default] tag to sources.conf if needed...
couldn't read file "/Contents/Resources/upgrade_sources_conf_default.tcl": no
such file or directory
Updating port image format...
couldn't read file "/Contents/Resources/images_to_archives.tcl": no such file or
directory
Synchronizing the MacPorts installation with the project's rsync server...
-bash: __PREFIX__/bin/port: No such file or directory
An attempt to synchronize your recent MacPorts installation with the project's
rsync server failed!
Please run 'sudo port -d selfupdate' manually to find out the cause of the
error.
You have succesfully installed the MacPorts system, launch a terminal and try it
out!
Read the port(1) manual page and http://guide.macports.org for help,
http://www.macports.org/contact.php if you need to get in touch with The
MacPorts Project.
Any ideas?
First invoke the port command directly:
$ /opt/local/bin/port help
If that comes back with something reasonable (like the help text) then it's just that your $PATH isn't being used by your current shell. Try logging off and back on again to resolve that in the short term (this will test that your .bashrc file is correctly configured) or you could just modify the PATH environment variable directly (which doesn't test .bashrc):
$ export PATH=$PATH:/opt/local/bin
You downloaded the postflight script but it alone cannot access the accessory scripts in Contents/ because those are located into the install package.
Those missing Tcl scripts are for upgrading from an older install, the log says PATH was already correctly configured but the macports bin directory could have the wrong position in PATH variables, for instance being at the end of PATH.
If you are doing a fresh install you can just only need PATH and MANPATH -you want man pages provided by macports before system's ones- as per [1]
[1] http://guide.macports.org/#installing.shell.postflight

Resources