Installing leiningen 2 on Ubuntu - clojure

I have followed the instructions here:
leiningen.org
To install from the lein script. I now have:
~/.lein/self-installs/leiningen-2.4.3-standalone.jar
How do I now run leiningen? The instructions are not clear.

On ubuntu, its quite easy. Download executable file, make it executable and place it in system path.
$ wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
$ chmod +x lein
$ sudo mv lein /usr/local/bin
You can also move it any directory which is in system path.
$ lein -v
Leiningen 2.6.1 on Java 1.8.0_77 Java HotSpot(TM) 64-Bit Server VM

Posting this as it might help other users.
Follow the install instructions.
Please make sure the leiningen script that the install instructions is on your executable PATH.
The script is the entry point to leiningen commands, so it's still needed after the downloads are complete.
It takes care of setting up environmental variables, paths and everything else required to run leiningen, so you can use
lein <command>
instead of
java -cp <whatever>:~/.lein/self-installs/leiningen-2.4.3-standalone.jar ... clojure.main -m leiningen.core.main <command>

I got the same doubt. Solved it. By following the instructions everything will be set for you. Next run the previously used script lein.sh in bin for creating projects as below.
suppose ~/bin/lein.sh is your script location ,then
$ ~/bin/lein.sh new test-project
$ ~/bin/lein.sh --help
It will create the project in your bin folder it self.If you wish to access that lein.sh globally then include it in $PATH.

If you are using a linux distribution you can just download the leiningen script and move it to your /bin folder. Once you've done that you can execute lein command and it will be installed for you.
So from your terminal you can run:
$ curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/lein
to download lein script to your root path. Then you set it as executable and move to your /bin folder
$ chmod x+a lein
$ sudo mv ~/lein /bin
$ lein
After you run the command lein from anywhere on your terminal the lein script will install leininge for your and you'll be able to use it normally.

Related

Vmware on Arch: Could not open /dev/vmmon: No such file or directory

I want to install VMware Workstation on Arch. I used the command yay -S vmware-workstation to install. After installation finished, I ran VMware, created an VM, started it, and got the error:
Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.
I tried to install linux-header but it still didn't work.
OS: Arch Linux, 5.10.56-1-lts.
Thanks for any help!
I ran into this problem too, and the solutions I found online ended up having their own problems that needed to be solve, which I'll document here.
To solve the error Could not open /dev/vmmon/: you need to run:
sudo vmware-mod-config --console --install-all
If this returns an error about Glib not having support, you need to clone https://github.com/mkubecek/vmware-host-modules.git and make it.
$ git clone https://github.com/mkubecek/vmware-host-modules.git
$ cd vmware-host-modules
$ git checkout -b 16.2.1 origin/workstation-16.2.1
$ sudo make
If this returns an error containing fatal error: generated/autoconf.h: No such file or directory, you need to install linux-headers and make sure it matches your linux kernel version. Probably also make sure your kernel is up to date, although I'm not sure if that's necessary.
$ sudo pacman -S linux
$ sudo reboot
$ sudo pacman -S linux-headers
Now you should be able to make install in that cloned repo, which should install the required modules for you to be able to run the vmware-mod-config --console --install-all command, which should solve the issue.
So working backwards, the steps are:
Update your linux kernel and install the right linux-headers for it.
Clone this git repo, cd into it, git checkout -b 16.2.1 origin/workstation-16.2.1, and run sudo make install
Run sudo vmware-mod-config --console --install-all
More about can be found at my post here: https://bbs.archlinux.org/viewtopic.php?pid=2020372#p2020372
I also encountered same problem. Most of the stackoverflow pages suggest to reinstall the vmware but its not a fair solution and even its not a solution. Its just like if you have pain in teeth remove that teeth.
Another thing is that some post and even vmware official posts said to disable secure boot.
But after trying both nothing changed so i goto to cd /dev and found that the file vmmmon exists.
And when i tries to load the file it loaded successfully.
So from here i concluded that to solve this issue do the following:
Either disable the secure boot or sign the vmmon.
CD to /dev/
Load vmmon using modprobe
and as always Happy coding....
The command: sudo vmware-modconfig --console --install-all works, but every time that I reboot the system the error come out again.
In my case, the cause of this problem was the vmmon didn't be load. So I just
sudo modprobe -v vmmon
and it work.

VS2019 - Sudo Remote Debugging on Linux with Cmake project

I have a cmake c++ Linux project that is using Remote Debugging from a windows computer. The program accesses the GPIO pins on Raspberry pi so it needs to run under sudo on the remote machine. Everything is building and working but it crashes on the first line that needs admin access. I have not been able to figure out how to launch the newly compiled application under sudo. I have tried different settings in the launch_schema.json but no luck so far.
I found this and it worked for me.
Unable to launch debugger (gdb) with root permissions.
Basically you decorate the existing gdb binary on the Pi with a bash script and then use the script.
The steps on the Pi are:
cd /usr/bin
sudo mv gdb gdborig
Now create a bash script named gdb with following content.
sudo nano gdb
Content of the bash is;
#!/bin/sh
sudo gdborig $#
Finally, make the script runnable with.
sudo chmod 0755 gdb
Thanks goes to Buğra Aydoğar

I am not sure what “: command not found” means when I run virtualenvwrapper mkvirtualenv command

I am learning Linux and how to set-up a Django environment for the first time.
I am not sure what “: command not found” means when I run virtualenvwrapper commands. Below is the command line sequence:
root#intranet-django:/home/lv/# workon
root#intranet-django:/home/lv/# mkvirtualenv temp
Using base prefix ‘/usr’
New python executable in /root/.virtualenvs/temp/bin/python3
Also creating executable in /root/.virtualenvs/temp/bin/python
Installing setuptools, pip, wheel…done
:command not found
root#intranet-django:/home/lv/# workon
temp
root#intranet-django:/home/lv/#
Create your virtualenv and specify you python3.x path by running this command mkvirtualenv -p /usr/local/bin python3.x <project_name>.
If you want to check your python3.x path, you run which python3.x in you terminal.

how to start lein with an existing clojure jar

I am trying to download/install/run clojure/lein and facing some initial problems. I am using cygwin on windows-7.
After downloading the latest clojure (1.8.0), the following step works fine:
java -cp clojure-1.8.0.jar clojure.main
Now I installed lein using the following steps (thanks to stackoverflow/18711805 for help):
download lein script into ~/bin , set filetype=unix
install wget and deps (see stackoverflow/18711805)
setenv HTTP_CLIENT "wget --no-check-certificate -O"
lein self-install
Now when I run "lein repl", I find that lein has downloaded another clojure version (1.7.0) and using that.
So, how can I ask lein to use my version of clojure (ie 1.8.0) and not the 1.7.0 ? Are there any extra environment variables to be set before the lein run?
Also, where does lein install its extra downloads, and how do I clean up that area?
"lein upgrade" did the trick, I got the hint from stackoverflow/24094597. Now when I run lein again I can see 1.8.0 (not my own install, but lein has installed this new version). But since I installed lein just a few minutes ago from scratch anyway, I am not sure why it did not install the latest version in the first place.

Running a Docker image command in a mounted folder

I'm trying to execute lein run in a Clojure Docker image out of a mounted folder that is not /, but when I try to cd into a folder, Docker complains with unable to locate cd:
docker run -v /root/chortles:/test -i jphackworth/docker-clojure cd /test && lein run
=> Unable to locate cd
How do I instruct Leiningen to run in a different folder, or tell Docker to change the directory prior to running my command?
You can use -w param for docker run. This parameter is useful for specifying working directory within container.
docker run -w /test -v /root/chortles:/test -i jphackworth/docker-clojure lein run
The best bet is to add a shell script to the docker image and call that.
Have a script called, say lein-wrapper.sh, install in in /usr/local/bin. The script should sort out the environment for leiningen and then call it. Something like this:
#!/bin/sh
export PATH=${LEININGEN_INSTALL}:${PATH}
cd /test
lein $#
You can set
ENTRYPOINT["/usr/local/bin/lein-wrapper.sh"]
In your Dockerfile
And invoke it as:
# Will call /usr/local/bin/lein-wrapper.sh run
# which will call lein run
docker run -v /root/chortles:/test -i jphackworth/docker-clojure run
# or run lein deps...
docker run -v /root/chortles:/test -i jphackworth/docker-clojure deps
cd is a bash builtin, not a command. You can use bash -c 'cd /test && lein run'. Better yet, do as #Jiri states and use the -w parameter to set the working directory of the container, then just use lein run to start your app.