Without cygwin windows is all but useless to me. I need my command line to get important
things done quickly.
As my current install of cygwin stands I have three problems
with it.
·
Slow boot up time (over 2 minutes)
·
Sloooow tab completion
·
Adding tools is a pain give me an apt-get!
So what can I do about it?
I tweaked on it for a few days and here is a procedure I
came up with
Get a list of your current installed packages
Start up cygwin.
Use cygcheck to get a list of all installed packages. I found this site http://blag.nullteilerfrei.de/2014/01/31/import-and-export-cygwin-list-of-installed-packages/
[1] that shows a quick way to do this
> cygcheck -c -d | sed -e
"1,2d" -e 's/ .*$//' > packagelist
|
Now looking at the file
> cat packagelist
|
I am going to filter this list a little and choose only the
ones I want. There are some ones I may
no longer need.
Re-install Cygwin
Now kill cygwin program
Rename the C:\cygwin64 folder to cygwin64.BACK
Go to https://www.cygwin.com/
Download setup-x86_64.exe
Now run it
Next
Next
Next
Next
Next
Choose a mirror and
click Next
Let it download
Don't bother with additional packages just click Next.
Click Next
Let it download
Click Finish
Fix the font
You may not have to do this, but I need to fix the font.
Right click on the window and select Options.
Text, Select
Lucida Sans Typewriter, size 22, and click OK.
Click Apply, and Save
Add apt-cyg package manager
I found this neat tool called apt-cyg there is a quick post
about how to use it at https://www.fir3net.com/UNIX/Linux/cygwin-package-installation.html
[2]
Here is how to set it up.
Close all Cygwin windows.
Open up a windows command prompt and run the following
command
(assuming the setup-x86_64.exe is in the download folder)
> %HOMEPATH%\Downloads\setup-x86_64.exe
-q -P git,wget,bzip2,tar,gawk,xz
|
This will auto load the git, wget, bzip2, tar, gawk, and
xz. These are needed for the apt-cyg
tool to work.
Let it run its course
Cygwin is now updated
Open a Cygwin prompt and run the following commands to
download and install apt-cyg.
> wget
rawgit.com/hagbarddenstore/apt-cyg/master/apt-cyg
> chmod +x apt-cyg
> mv apt-cyg /usr/bin/
|
Make a symlink cause I know I am going to type apt-get
> touch /usr/bin/apt-get
> ln -fs /usr/bin/apt-cyg
/usr/bin/apt-get
|
Now you can install package from here J
List hexedit pacakges
> apt-cyg show hexedit
|
Install it
> apt-cyg install hexedit
|
And it has been added and no need to reboot cygwin!
Before I install the tools I need I want to add cygwinports as a repo.
Add cygwinports as a repo
First a test… try and find httrack
> apt-cyg show httrack
|
Unable to find…. It
is available at cygwinports. So let's
add that repo
From cygwin run this command.
> cygstart --
/cygdrive/c/Users/patman/Downloads/setup-x86_64.exe -K
http://cygwinports.org/ports.gpg
|
Click Run
Click Next
Next
Click Next
Click Next
Click Next.
Put this fpt site in (Make sure not to add any spaces at the
end) and click Add
ftp://ftp.cygwinports.org/pub/cygwinports
Select the ftp.cywingports.org
hold ctrl and select an additional Download Site
hold ctrl and select an additional Download Site
I chose cygwin.mirror.constant.com
Double check make sure both are highlighted and click Next.
Let it download and set up.
As a test, search for httrack. If you see it you are good! Do not install it
now. Just click Next.
Let it download.
Click Finish
Restart Cygwin
Test it to see if it sees the new repo
> apt-cyg show httrack
|
OK that is not right
Edit /etc/setup/setup.rc
> vi /etc/setup/setup.rc
|
Change last-mirror to
Just to cygwinports…
Will allow httrack to work but not autoconf…. I think
apt-cyg is only allowing one mirror to be used at a time.
Yep check this old post out
https://odoepner.wordpress.com/2012/12/06/install-cygwin-and-cygwinports-packages-using-apt-cyg/
[3]
It always takes the first one…
So I can just swap the last-mirror each time I need
cywin.mirror or attempt to fix the apt-cyg code….
… Well for now I will just
swap back and forth
Install all my packages
These are the packages I want… your mileage may vary…
First I am going to install the ones that do not need
cygwinports
> time apt-cyg install autoconf automake bind curl
gcc-core gcc-fortran gcc-g++ git-completion hexedit libusb1.0 libusb1.0-devel
make openssh postgresql-client rsync ruby screen sed tree tmux whois unzip
vim
|
Then reset /etc/setup/setup.rc to cywginports
> vi /etc/setup/setup.rc
|
> time apt-cyg install httrack jq
|
Now let me test how fast it boots up!
Starts up in under 10 seconds and tab completion is fine
Copy .ssh etc
Of course change the username to your own
Copy the .ssh
folder
> cp -r
/cygdrive/c/cygwin64.BACK/home/patman/.ssh .
|
Copy the .gitconfig
file
> cp /cygdrive/c/cygwin64.BACK/home/patman/.gitconfig .
|
Copy the .screenrc
file
> cp
/cygdrive/c/cygwin64.BACK/home/patman/.screenrc .
|
Copy the .tmux.conf
file
> cp
/cygdrive/c/cygwin64.BACK/home/patman/.tmux.conf .
|
Copy the .vimrc
file
> cp
/cygdrive/c/cygwin64.BACK/home/patman/.vimrc .
|
Copy .bash_profile
> cp
/cygdrive/c/cygwin64.BACK/home/patman/.bash_profile .
|
Restart cygwin
It's all working well now!
Sdkman and a fix
I found this cool tool sdkman see http://sdkman.io/install.html
[4]
for installing skd tools like scala, sbt, groovy, grails…
To install it run
> curl -s get.sdkman.io |
bash
|
Now run
> source
"$HOME/.sdkman/bin/sdkman-init.sh"
|
Test
> sdk version
|
I already have java installed and set up
> java -version
> which java
|
So I am going to install scala 2.11.7 and sbt using the sdk
tool
> sdk install sbt
> sdk install scala 2.11.7
|
Test it (of course
running sbt will take a while the first time)
> sbt sbtVersion
> scala -version
|
Fixing sdk
Now if I restart cygwin it takes forever…. 60 seconds to
start… Though tab completion is fine.
If you look at the end of .bashrc and .bash_profile you will
see this.
… .bash_profile calls .bashrc so this code gets called
twice.
Remove this from .bashrc and I cut start up down to 30ish
seconds
But this code is still killing me..
I added
set -vx
to .bash_profile and
And figured out that it only took 6 seconds to get to here
then the sdk code was killing me.
The way I figured my way around this was to comment this
code out when I do not need sdkman. And
to add PATHS to the sdk code it adds.
So in my case I updated it to
#THIS
MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
#export
SDKMAN_DIR="/home/patman/.sdkman"
#[[
-s "/home/patman/.sdkman/bin/sdkman-init.sh" ]] && source
"/home/patman/.sdkman/bin/sdkman-init.sh"
#Comment
this out when running sdkman
export
PATH=$PATH:/home/patman/.sdkman/candidates/scala/current/bin
export
PATH=$PATH:/home/patman/.sdkman/candidates/sbt/current/bin
|
Now restart cygwin
< 10 second start up
And sbt and scala, which I installed via sdkman
Test it
> sbt sbtVersion
> scala -version
|
OK I think I am good J
References
[1] Import &
Export Cygwin List of installed Packages http://blag.nullteilerfrei.de/2014/01/31/import-and-export-cygwin-list-of-installed-packages/
Accessed 02/2016
[2] How do I
install a Package Manager within Cygwin ?
Accessed 02/2016
[3] Install
cygwin and cygwinports packages using apt-cyg
https://odoepner.wordpress.com/2012/12/06/install-cygwin-and-cygwinports-packages-using-apt-cyg/ Accessed 02/2016
[4] sdkman
Accessed 02/2016
No comments:
Post a Comment