Archive
vim on Debian 9 issue with cut and paste
While using vi (vim) on Debian 9 via cli, there is an issue with cut and paste with a mouse.
This can be corrected by adding a .vimrc file to your user folder as shown below
##CONTENTS OF .vimrc
.vimrc
set mouse=””
This will re-enable the mouse cut and paste feature from a terminal.
Upgrade Debian Jessie to Strech
The upgrade process is easy via the cli.
Just complete the following and answer any questions.
I let the system restart daemons automatically and kept original conf files.
This has worked on three Debian 8 systems without a hitch.
apt-get update
apt-get upgrade
apt-get dist-upgrade
cp /etc/apt/sources.list /etc/apt/sources.list_backup
sed -i ‘s/jessie/stretch/g’ /etc/apt/sources.list
apt-get update
apt list –upgradable
apt-get upgrade
apt-get dist-upgrade
After completing you can reboot and autoremove old packages.
copy your debian installed packages to a new machine
Run this to retrieve a list of installed packages:
dpkg -l | grep ^ii | awk ‘{print $2}’ > installed_packages
Then install on new system with:
apt-get install $(cat installed_packages)
You should probably look at installed_packages and remove any obvious
errors.
Turn on syntax (color) in vim for Debian
To add syntax checking to vim with Debian, just edit /etc/vim/vimrc and uncomment
the “syntax on” line.
Then your editor will show (in color) syntax errors in Postfix and html/css files.
disable or enable ipv6 ssh
You may experience problems with ssh and ipv6. If so edit the /etc/ssh/sshd_config file
and enable the ListenAddress 0.0.0.0 option. You can also enable (unpound) the ipv6
option ListenAddress ::.
You may experience lockouts from ssh if you have AAAA ipv6 records in your nameserver if
you don’t make theses changes.
Be sure and restart ssh after changes.
Check Spamassassin perl modules
To check spamassassin and verify all required perl modules are installed
run this:
spamassassin -D –lint 2>&1 | grep -i failed
then use cpan install module::name ie
cpan install Digest::SHA1
Some additions are required to augment the default install. There is benefit
to adding missing modules as a more complete spam analysis will occur.
Backup/Copy mysql or mariadb database
You can copy or backup all your databases with these commands including
coping to another server.
# backup
mysqldump -u root -p yourdb > mysqlbak.sql
or for dumping all databases
mysqldump –all-databases -u root -p > mysqlbakall.sql
# restore
mysql -u root -p yourdb < mysqlbak.sql
to restore all databases
mysql -u root -p < mysqlbakall.sql
Cloning mikrotik routerboard (rb7xx, rb9xx, rb11xxx)
You can easily clone like routerboard hardware with these commands:
First to ssh admin@youripaddress or run terminal from winbox and run the following on the device you want to clone in this example we clone an rb751g to rb951.
## on rb751g type:
/export compact file=name
Then copy the name.rsc file to the rb951 $$either drag and drop it to files with winbox or use sftp.
hard reset the device you want to clone to by powering off and holding reset button, powering on,
and releasing reset button when led next to power plug starts to rapidly flash. Wait until the
os initializes and access with winbox.
## on rb951 type (after hard reset):
/import name.rsc ## you should see no errors.
## then on rb951 type:
/system reset run-after-reset=”name.rsc”
This will clear the current config and import the one from the rb751g
After a minute to load or so you should be able to access the rb951 with winbox and have a complete clone
of the rb751g.
Install libguestfs-tools and add serial console access to your vm
To add serial access to your vm, with Debian/Ubuntu apt-get install libguestfs-tools.
Then with vm shutdown, execute the following:
root:~# guestmount -d vmname -i /mnt
root:~# ln -s /mnt/lib/systemd/system/getty@.service /mnt/etc/systemd/system
/getty.target.wants/getty@ttyS0.service
root:~# umount /mnt
Reboot your vm and you should have serial console access.
backup your kvm vm with dd
The dd utility is a good way to make a backup of your kvm vm image. It
is nice to have a progress indicator so install pv (pipe viewer) to
gain this feature ..ie apt-get install pv.
Here is a backup script:
dd if=org.img | pv | dd of=backup.img bs=1M
On my system it took about 10 minutes to complete a backup of a 50g image.