Not going to repeat it (assuming it will work for me as well): https://harsimranmaan.medium.com/install-and-setup-rust-development-environment-on-wsl2-dccb4bf63700
Coder Samurai
2023. március 25., szombat
2022. november 16., szerda
POSIX development on windows
With Windows Subsystem for Linux (WSL for sort) you can do all sorts of amazing things, including developing POSIX compatible code, all in your favorite (?) Windows environment. Let's get to it, it is less complicated than it looks.
Install WSL
It should be as simple as running this from an administrator command line:
wsl --install
If it does not work for you, you may need to tweak your BIOS settings, install windows features, or something else. This article should be a good starting point for your troubleshooting.
I will be using the default (Ubuntu) installation as an example.
If all went well, you can start your linux machine from the cmd line with "wsl" or from the start menu as "Windows Subsystem for Linux". Do it now.
Install linux tools
An example list, tweak it to your taste:
sudo apt install gcc gdb valgrind make pkg-config doxygen
Install VS Code and tools
I am 99% sure you have VS code installed already. If not, you can find some resources here.
WSL for VS Code is a funny little beast, unless you are familiar with the split brains approach (some other languages use this as well), it might worth try to look at it here.
Long story short, Remote Development extension pack is all you need to work with your WSL.
C/C++ Extension Pack might also be interesting.
To be continued...
2019. november 9., szombat
LFTP job management
It is a bit different than default linux job management
exit - detaches terminal from the session, disconnects from the server
exit - again, exits lftp and sends the job to background
Send job to background
putting a job into a background:- start in background mode, i.e. pget remotefile.big & OR
- start normal mode, then press ctrl + Z
exit - detaches terminal from the session, disconnects from the server
exit - again, exits lftp and sends the job to background
... and get back to it later
ps aux | grep -v grep | grep lftp | awk '{print $1}' - find the PID for the main lft session
lftp - start lftp
attach <PID> - attach to the terminal of the background session
some more useful commands
jobs - check the status of the running jobs
wait, fg - bring the job to the foreground
kill - kills a bg job, or all of them
2019. november 8., péntek
Manage SSH public keys with github
This is just another note-to-self post.
Wouldn't be nice to have your publickey stored in someplace where you can import it to .ssh/authorized_keys? Apparently github is a very convenient place for exactly that.
Wouldn't be nice to have your publickey stored in someplace where you can import it to .ssh/authorized_keys? Apparently github is a very convenient place for exactly that.
Generate your digital identity (source)
Luckily you only need to do this once.- In Git Bash (or your linux machine)
- ssh-keygen -t rsa -b 4096 -C "your_github_email@example.com
- Add the public key to github (source):
- Find your public key file. The default location is ~\.ssh\id_rsa.pub
- Go to https://github.com/settings/keys and add it ot your keys
- (optional, Windows & Putty only) Convert public key to putty format (source):
- Open puttygen, and:
- Click Conversions/Import key.
- Navigate to the OpenSSH private key and click Open.
- Under Actions / Save the generated key, select Save private key.
- Choose an optional passphrase to protect the private key.
- Save the private key as id_rsa.ppk.
- Open putty, and:
- In Session tab, load the config you want to change
- Open SSH/Auth, tab, Browse the id_rsa.ppk
- Back in the session tab, Save the config
Import the key on the server you are connecting
Yes, on all of them
- On your remote server, you can add the public key like this (tested on ubuntu server): ssh-import-id gh:<github_user_id>
Troubleshooting
(Putty only): make sure your client actually sends in the key. The ky file location stored with the saved session
On the remote server side:
chmod 700 ~/.ssh - to fix permission errors on the folder
chmod 600 ~/.ssh/authorized_keys - to fix permission errors on the file
2017. szeptember 19., kedd
Alpine Linux install
If you start working on Docker these days it is inevitable to run into Alpine Linux at certain point. It offers 1/10 of the size of a Debian based container (5 mb vs 50 mb), and many application stacks already offer Alpine based image to derive your micro services from. Debian can be slimmed down pretty well and there is a loyal following using it for containers and servers as well.
To try it out I decided to build a VM based on Alpine so I can evaluate it as a container image base.
Adventures in the Alpines so far:
workgroup = WORKGROUP
netbios name = server1
security = user
map to guest = Bad User
dns proxy = no
To try it out I decided to build a VM based on Alpine so I can evaluate it as a container image base.
Adventures in the Alpines so far:
- There is a pretty good starting guide, with some caveats:
- use bridged connection instead of nat if you want to see your vm from your host/other machines in the network, and performs better too
- use the latest-stable url to enable community repository, otherwise you could get some ugly kernel incompatibility errors
- Minimalist samba install (loosely based on this wiki page)
- apk add samba
- mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
- nano /etc/samba/smb.conf
- Enter the above to the text editor, save and exit
workgroup = WORKGROUP
netbios name = server1
security = user
map to guest = Bad User
dns proxy = no
- Start/enable service
- rc-update add samba
- rc-service samba start
- Enable ssh access
- nano /etc/ssh/sshd_config
- #PermitRootLogin prohibit-password => PermitRootLogin yes
- rc-service sshd restart
- Docker install is fairly simple
- apk add docker
- rc-update add docker boot
- rc-service docker start
- Some other utilities to install:
- apk add git
- apk add nodejs
2017. szeptember 16., szombat
CentOS howto V - Custom systemd service
- nano /etc/systemd/system/cloning-vat.service
[Service]
WorkingDirectory=/home/shared/cloning-vat/
ExecStart=/usr/bin/npm start
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cloning-vat
User=nodejs
Group=nodejs
Environment=NODE_ENV=development
[Install]
WantedBy=multi-user.target
- systemctl daemon-reload
- systemctl enable cloning-vat
- systemctl start cloning-vat
CentOS howto IV - Poking holes in security (in a meaningful way)
- Add an existing service
- firewall-cmd --permanent --zone=public --add-service=https
- firewall-cmd --reload
- Create a new service (to be added as above). In this example we will be using livereload default port 35729
- firewall-cmd --permanent --new-service=live-reload
- firewall-cmd --permanent --service=live-reload --set-description="live reload"
- firewall-cmd --permanent --service=live-reload --set-short="live reload"
- firewall-cmd --permanent --service=live-reload --add-port=35729/tcp
- Enabling an application (node.js in this example) to bind ports <1024
- setcap 'cap_net_bind_service=+ep'/ usr/bin/node
Feliratkozás:
Bejegyzések (Atom)