Last active
January 14, 2017 12:09
-
-
Save Kibur/845b4e3533ea3302bf01 to your computer and use it in GitHub Desktop.
General Linux and other related stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My general experiences about GNU/Linux distro's and other stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
set -o errexit | |
############################################################################### | |
##### This script will generate an IPv4-only hosts file that blocks domains | |
##### responsible for advertisements, analytics, and malicious activities | |
##### | |
##### Modified from: https://github.com/fr0stycl34r/update-hosts | |
############################################################################### | |
## We must be root in order to modify the contents of /etc | |
rootcheck() { | |
if [[ $UID -ne 0 ]]; then | |
echo "Please run this script as root" | |
exit 1 | |
fi | |
} | |
rootcheck | |
## Backup the current hosts file | |
mv /etc/hosts /etc/hosts.bak | |
## Create a temporary file to dump the various lists into | |
temphosts=$(mktemp) | |
## Download various pre-made lists into our temp file | |
wget -nv -O - http://someonewhocares.org/hosts/hosts >> $temphosts | |
wget -nv -O - http://winhelp2002.mvps.org/hosts.txt >> $temphosts | |
wget -nv -O - http://www.malwaredomainlist.com/hostslist/hosts.txt >> $temphosts | |
wget -nv -O - http://adblock.gjtech.net/?format=hostfile >> $temphosts | |
wget -nv -O - http://hosts-file.net/ad_servers.asp >> $temphosts | |
wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> $temphosts | |
## Cleanup the list; remove commented lines, remove duplicates, etc | |
sed -e 's/\r//' -e '/^127.0.0.1/!d' -e '/localhost/d' -e 's/0.0.0.0/127.0.0.1/' -e 's/ \+/\t/' -e 's/#.*$//' -e 's/[ \t]*$//' < $temphosts | sort -u > /etc/hosts | |
## Append some necessary stuff to the beginning of the file | |
echo "# Last updated on $(date) | |
127.0.0.1 localhost | |
127.0.0.1 $HOSTNAME" | cat - /etc/hosts >> temp && mv temp /etc/hosts | |
## A bit of cleanup | |
rm $temphosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding users and creating a home directory | |
------------------------------------------ | |
useradd <name> | |
passwd <name> | |
mkdir /home/<name> | |
chown <name>:users /home/<name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://wiki.archlinux.org/index.php/Beginners%27_guide | |
timedatectl set-ntp true | |
timedatectl status | |
Partitioning | |
------------ | |
parted -a optimal /dev/sdb | |
# check if NO partition | |
# if partition | |
rm [partition number] | |
mklabel gpt | |
mkpart primary 1MiB 3MiB (bios partition) | |
name 1 grub | |
set 1 bios_grub on | |
mkpart primary ext4 3MiB 100MiB (/boot partition) | |
name 2 boot | |
set 2 boot on | |
mkpart primary 100MiB 2150MiB (swap partition) | |
name 3 swap | |
mkpart primary ext4 2150MiB 100% | |
name 4 rootfs | |
# ignore lba | |
quit | |
mkfs.ext4 -L "boot" /dev/sdb2 | |
mkfs.ext4 -L "rootfs" /dev/sdb4 | |
mkswap -L "swap" /dev/sdb3 | |
swapon /dev/sdb3 | |
mount /dev/sdb4 /mnt | |
mkdir -p /mnt/boot | |
mount /dev/sdb2 /mnt/boot | |
Install & Configure Arch | |
------------------------- | |
pacstrap /mnt base base-devel vim | |
genfstab -U -p /mnt >> /mnt/etc/fstab | |
arch-chroot /mnt /bin/bash | |
vim /etc/locale.gen | |
# uncomment en_US.UTF-8 UTF-8, as well as other needed localisations | |
:wq | |
locale-gen | |
echo LANG=en_US.UTF-8 > /etc/locale.conf | |
tzselect | |
ln -sf /usr/share/zoneinfo/Europe/Brussels /etc/localtime | |
hwclock --systohc --utc | |
vim /etc/mkinitcpio.conf | |
# change HOOK order (HOOKS = "base udev autodetect modconf block filesystems keyboard fsck") | |
/HOOKS | |
HOOKS = "base udev block autodetect modconf filesystems keyboard fsck" | |
:wq | |
mkinitcpio -p linux | |
pacman -S sudo | |
EDITOR=nano visudo | |
# uncomment "%wheel ALL=(ALL) ALL" | |
Ctrl+O | |
Ctrl+X | |
pacman -S grub [os-prober] (search for other operating systems) | |
grub-install --recheck /dev/sdb | |
grub-mkconfig -o /boot/grub/grub.cfg | |
echo archpleb > /etc/hostname | |
systemctl enable dhcpcd@enp2s5.service | |
(Wireless): | |
pacman -S iw wpa_supplicant dialog | |
passwd | |
exit | |
umount -R /mnt | |
reboot | |
useradd -m -g users -G wheel,storage,power,audio,video -s /bin/bash pleb | |
passwd pleb | |
Installing basic stuff | |
----------------------- | |
pacman -S alsa-utils alsa-tools pulseaudio pulseaudio-alsa | |
pavucontrol ttf-dejavu samba smbclient networkmanager networkmanager-vpnc | |
networkmanager-pptp networkmanager-openconnect network-manager-applet gvfs gvfs-smb sshfs | |
systemctl enable NetworkManager | |
reboot | |
Install XFCE desktop environment | |
--------------------------------- | |
https://wiki.archlinux.org/index.php/Xorg (info about graphic cards) | |
pacman -S xorg-server xorg-server-utils xorg-xinit xorg-utils | |
pacman -S xfce4 xfce4-goodies gamin firefox | |
cp /etc/X11/xinit/xinitrc ~/.xinitrc | |
vim ~.xinitrc | |
# Comment existing exec and add | |
exec startxfce4 | |
startx | |
Install LightDM login manager | |
----------------------------- | |
pacman -S lightdm lightdm-gtk-greeter | |
systemctl enable lightdm.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using the Arduino with "Arduino IDE" or "Processing" | |
---------------------------------------------------- | |
Default you don't have access to the Arduino. | |
Because you need to be root. | |
But this is not a good solution. | |
If you program as root, all your projects will be owned by user "root". | |
Which is not what you want because this will cause even more problems. | |
My solution to this is just. | |
Change the rights, but TEMPORARY! | |
Just change the access rights when you use the Arduino. | |
Before changing the rights. | |
I first checked what are the default rights. (/dev/ttyACM0) chmod 660. | |
To make things simple I just change the rights to chmod 777. | |
Granting all users full access, which should solve everything. | |
But before I disconnect and after I don't need it anymore. | |
I put the default access rights back to normal chmod 660. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkg check -> Sanity checks installed packages. | |
pkg clean -> Cleans the local cache of fetched remote packages. | |
pkg delete -> Delete a package from the database and the system. | |
pkg fetch -> Fetches packages from a remote repository. | |
pkg install -> Install a package from a remote package repository. | |
pkg plugins -> List the available plugins. | |
pkg search -> Search for the given pattern in the remote package repositories. | |
pkg update -> Update the available remote repositories. | |
pkg upgrade -> Upgrade a package to a newer version. | |
pkg autoremove -> Remove unneeded dependencies. | |
pkg set -A 1 -> Change a package from non-automatic to automatic, which will make autoremove allow it be removed once nothing depends on it. | |
pkg audit -> Audit installed packages for security advisories. | |
pkg check -s -a -> Check installed packages for checksum mistakes. | |
pkg check -d -a -> Check for missing dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This will override the terminal history file | |
# | |
echo '' > '/home/{username}/.bash_history' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This will override the VIM history file | |
# | |
echo '' > '/home/{username}/.viminfo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The new way for configuring your ethernet adapter | |
This has been tested with Arch Linux. | |
But should also work on every other GNU/Linux distro. | |
"ifconfig" is replaced by "ip addr" | |
For debian users... | |
Modifying /etc/network/interfaces is not necessary anymore. | |
Because this was typically for debian or debian based distros. | |
They changed this so that you only have remember the same commands | |
which works on every other GNU/Linux distro. | |
1)Giving a static ip address. | |
ip addr add <ipv4/prefix or ipv6/prefix> dev <interface> | |
Example: ip addr add 192.168.0.2/24 dev enp2s5 | |
2)Add default gateway for your interface. | |
ip route add default via <ipv4> dev <interface> | |
Example: ip route add default via 192.168.0.1 dev enp2s5 | |
No need to restart your ethernet adapter!! | |
Which is really nice. | |
So those are the two commands you need to learn. | |
And those will work for all GNU/Linux distributions. | |
This makes testing or using other GNU/Linux distros alot more | |
easier. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Monitor the CPU temperature | |
--------------------------- | |
To begin with you need lm-sensors package. | |
sudo apt-get install lm-sensors | |
Use following command to setup your sensors, if it's the first time. | |
sudo sensors-detect | |
The sensors-detect might not detect everything depending on your computer support. | |
You may still find a basic set of sensors for the CPU. | |
Real-time temperature display in the Terminal. | |
watch -n (delay in seconds) -d/-f sensors | |
ex.: watch -n 1 -d sensors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a script that executes at startup (https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian) | |
---------------------------------------- | |
1. Create your script in /etc/init.d and add: | |
### BEGIN INIT INFO | |
# Provides: skeleton | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. | |
### END INIT INFO | |
Otherwise you will get "insserv: warning: script '{script}' missing LSB tags and overrides" when adding in "update-rc.d". | |
You can change the start and stop order of your script. | |
2. chmod 755 /etc/init.d/{script} | |
3. update-rc.d {script} defaults | |
Done! | |
To remove your script: | |
update-rc.d -f {script} remove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://wiki.gentoo.org/wiki/Handbook:X86/Full/Installation | |
Partitioning | |
------------- | |
parted -a optimal /dev/sdb | |
mklabel gpt | |
mkpart primary 1MiB 3MiB (bios) | |
name 1 grub | |
set 1 bios_grub on | |
mkpart primary ext4 3MiB 131MiB (boot) | |
name 2 boot | |
set 2 boot on | |
mkpart primary 130MiB 643MiB | |
name 3 swap | |
mkpart primary ext4 643MiB 100% | |
name 4 rootfs | |
Creating file systems | |
---------------------- | |
# ext4 partitions smaller than 8Gb | |
mke2fs -j -T small /dev/sdb | |
mkfs.ext4 /dev/sdb2 | |
mkfs.ext4 /dev/sdb4 | |
mkswap /dev/sdb3 | |
swapon /dev/sdb3 | |
Mounting | |
--------- | |
mount /dev/sdb4 /mnt/gentoo | |
mkdir /mnt/gentoo/boot | |
mount /dev/sdb2 /mnt/gentoo/boot | |
Installing a stage tarball | |
--------------------------- | |
date -R | |
# if date is not right | |
date MMDDhhmmYYYY | |
cd /mnt/gentoo | |
links https://www.gentoo.org/downloads/mirrors/ | |
# download stage3-<arch>-<release>.tar.bz2 | |
# checksums stage3-<arch>-<release>.tar.bz2.DIGESTS.bz2 | |
openssl dgst -r -sha512 stage3-<arch>-<release>.tar.bz2 | |
openssl dgst -r -whirlpool stage3-<arch>-<release>.tar.bz2 | |
# check both hashes with those from DIGESTS | |
cat stage3-<arch>-<release>.tar.bz2.DIGESTS.bz2 | |
tar xvjpf stage3-*.tar.bz2 --xattrs | |
Configuring compile options | |
---------------------------- | |
vim /mnt/gentoo/etc/portage/make.conf | |
# commented listing of all possible variables | |
:tabnew /mnt/gentoo/usr/share/portage/config/make.conf.example | |
CFLAGS="-march=native -O2 -pipe" | |
MAKEOPTS="-j<CPU cores + 1>" | |
# add extra modules in USE | |
USE = "pulseaudio python networkmanager lm_sensors" | |
VIDEO_CARDS="" | |
INPUT_DEVICES="" | |
ALSA_CARDS="" | |
:wq | |
Chrooting | |
---------- | |
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf | |
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf | |
# double check if the mirrors are selected | |
cat /mnt/gentoo/etc/portage/make.conf | |
cp -L /etc/resolv.conf /mnt/gentoo/etc/ | |
mount -t proc proc /mnt/gentoo/proc | |
mount --rbind /sys /mnt/gentoo/sys | |
mount --make-rslave /mnt/gentoo/sys | |
mount --rbind /dev /mnt/gentoo/dev | |
mount --make-rslave /mnt/gentoo/dev | |
chroot /mnt/gentoo /bin/bash | |
source /etc/profile | |
export PS1="(chroot) $PS1" | |
Configuring Portage | |
-------------------- | |
emerge-webrsync | |
emerge --sync | |
eselect profile list | |
eselect profile set 3 | |
Timezone | |
--------- | |
echo "Europe/Brussels" > /etc/timezone | |
emerge --config sys-libs/timezone-data | |
Configure locals | |
----------------- | |
nano -w /etc/locale.gen | |
locale-gen | |
eselect locale list | |
eselect locale set 2 (en_US.utf8) | |
env-update && source /etc/profile | |
Installing the sources | |
----------------------- | |
emerge -av sys-kernel/gentoo-sources | |
Default:Manual configuration | |
----------------------------- | |
emerge -av sys-apps/pciutils | |
lsmod (kernel modules the live cd uses) | |
cd /usr/src/linux | |
make menuconfig (really important configs, know what you are doing) | |
make && make modules_install | |
make install | |
Using genkernel | |
---------------- | |
ermerge -av sys-kernel/genkernel | |
nano -w /etc/fstab | |
>> /dev/sda2 /boot ext4 defaults 0 2 | |
genkernel all | |
Kernel modules | |
--------------- | |
# view all available modules | |
find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less | |
nano -w /etc/conf.d/modules | |
emerge -av sys-kernel/linux-firmware | |
Network information | |
-------------------- | |
nano -w /etc/conf.d/hostname | |
emerge -av --noreplace net-misc/netifrc | |
nano -w /etc/conf.d/net | |
# if DHCP | |
>> config_<iface>="dhcp" | |
# static | |
>> config_<iface>="192.168.x.x netmask 255.255.255.0 brd 192.168.x.255" | |
routes_<iface>="default via 192.168.x.1" | |
cd /etc/init.d | |
ln -s net.lo net.<iface> | |
rc-update add net.<iface> default | |
emerge -av sys-apps/pcmciautils | |
System information | |
------------------- | |
passwd | |
nano -w /etc/rc.conf | |
nano -w /etc/conf.d/keymaps | |
nano -w /etc/conf.d/hwclock | |
# none UTC | |
>> clock="local" | |
System logger | |
-------------- | |
emerge -av app-admin/syslog-ng | |
rc-update add syslog-ng default | |
emerge -av sys-process/cronie | |
rc-update add cronie default | |
emerge -av sys-apps/mlocate | |
Networking tools | |
----------------- | |
emerge -av net-misc/dhcpcd | |
Default: Using GRUB2 | |
--------------------- | |
# using BIOS | |
emerge -av sys-boot/grub | |
grub2-install /dev/sdb | |
# using UEFI | |
echo GRUB_PLATFORMS="efi-64" >> /etc/portage/make.conf | |
emerge -av sys-boot/grub | |
grub2-install --target=x86_64-efi --efi-directory=/boot | |
grub2-mkconfig -o /boot/grub/grub.cfg | |
Rebooting the system | |
--------------------- | |
exit | |
umount -l /mnt/gentoo/dev{/shm,/pts,} | |
umount /mnt/gentoo{/boot,/sys,/proc,} | |
reboot | |
Disk cleanup | |
------------- | |
rm -v /stage3-*.tar.bz2* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to kill a specific process in Linux. | |
You might already know, you can only kill processes by knowing their PID. | |
So first you need to find out what's the PID. | |
$ ps aux | grep <process_name> : POSIX and UNIX method | |
$ ps -ef | grep <process_name> | |
The output is a little bit different. | |
If you see only one reponse it means the process you are looking for is not running. | |
If there are more than one. Most of times it's the first result the one you are looking for. | |
After you have identified your process. Just kill it as root. | |
$ sudo kill -9 <PID> | |
-9 flag means HALT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mount a USB drive on Linux: | |
Check for available devices to mount: | |
$ sudo fdisk -l | |
$ sudo mount -v '/dev/{device}{partition}' '/{mount dir}' | |
I recommend using '/mnt' as mount. | |
But you can also use '/media/{username}' which is what Ubuntu does. | |
If you want to mount multiple devices you should consider making directories. | |
$ sudo mkdir '/mnt/USB DISK' | |
$ sudo mount -v '/dev/sdc1' '/mnt/USB DISK' | |
Will mount but the -v (verbose) will argue because of the type. | |
You can give a type which is better but you don't need it. | |
It will choose the right one. But here an example: | |
$ sudo mount -v -t vfat '/dev/sdc1' '/mnt/USB DISK' | |
Now it won't argue anymore. | |
Unmount a USB drive on Linux: | |
First you need to check what you want to unmount. | |
You can do this with following command: | |
$ sudo mount -l | |
If you mount with the system or auto mounts. | |
You can go in the directory where the device is mounted. | |
There are 2 places '/mnt' or '/media' differs from distro. | |
In my case Linux Mint (Ubuntu based) it's '/media'. | |
More specific '/media/{username}/' | |
Be sure to check it with: | |
$ ls -al '/media/{username}' <- will show hidden files and folders. | |
How to unmout (examples): | |
$ sudo umount -v '/mnt/USB DISK' | |
$ sudo umount -v '/media/{username}/{device_name}' | |
$ sudo umount -v '/dev/sdc1' | |
Do not forget to remove the directory/directories you created. | |
$ sudo rmdir '/mnt/USB DISK' <- save remove. It will fail if it's not empty. | |
Incase you want to remove the directory and all files and all subdirectories. | |
$ sudo rm -rv '/mnt/USB DISK' | |
$ sudo rm -rfv '/mnt/USB DISK' <- -f is Force in case you got a problem | |
Yes, it's 'umount' not 'unmount'! | |
-v flag is verbose. Might give helpful hints if something went wrong. | |
Real life situation: | |
Laptop with SD card reader (sdb). | |
Only 1 device connected (USB pen drive device sdc) | |
$ sudo fdisk -l | |
Look for all sdc. Usually 2, 1 = /dev/sdc + 1 = /dev/sdc1. | |
If you have more than one partition you will have more '/dev/sdc2' | |
But I only have one partition so sdc1. | |
Will first make a directory for structure purpose. | |
$ sudo mkdir '/mnt/USB DISK' | |
$ sudo mount '/dev/sdc1' '/mnt/USB DISK' | |
To unmount you have the choice. | |
Unmount by partition location '/dev/sdc1' or mount point '/mnt/USB DISK' | |
You might prefer using the mount point IF you have some structure. | |
Interesting command: | |
$ sudo mount -l | |
It gives all mounted devices and their mount point. | |
> /dev/sdc1 on /mnt/USB DISK type vfat (rw) [USB] | |
$ sudo umount '/dev/sdc1' | |
$ sudo umount '/mnt/USB DISK' | |
And remove the directory you created. Which is annoying ofcourse. | |
$ sudo rmdir '/mnt/USB DISK' | |
-r = recursive (will remove everything in side the folder) | |
-v = verbose (gives extra information for debugging) | |
And if you don't use -r it won't remove the directory. | |
> rm: cannot remove ‘/mnt/USB DISK’: Is a directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grant internet connection to a Raspberry Pi connected peer-to-peer with a computer | |
---------------------------------------------------------------------------------- | |
Has been done with Ubuntu 12.04 LTS | |
Info about: | |
Peer-to-peer with Raspberry Pi: | |
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=36596 | |
Sharing a wireless connection via ethernet port: | |
http://chrisjrob.com/2011/03/14/sharing-a-wireless-connection-via-ethernet-port/ | |
Mount the SD card into the PC: | |
mount /dev/mmcblk0p2 /mnt | |
Edit /mnt/ect/network/interfaces with following: | |
auto eth0 | |
allow-hotplug eth0 | |
iface eth0 inet static | |
address 10.42.0.3 | |
netmask 255.255.255.0 | |
gateway 10.42.0.1 | |
Set a shared network for wired connection: | |
NetworkManager > Edit Connections... | |
Ethernet > Wired connection 1 - Edit... | |
IPv4 Settings > Methods: Shared to other computers - Save... | |
Interface eth0 should get 10.42.0.1 as IP address | |
Activate IP forwarding, and setup iptables to NAT: | |
sysctl -w net.ipv4.ip_forward=1 | |
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE | |
If the client gets Host Prohibited responses: | |
iptables -F FORWARD | |
iptables -A FORWARD -j ACCEPT | |
iptables -nvL | |
Boot Raspberry Pi, get console access and internet should work: | |
ssh pi@10.42.0.3 | |
sudo apt-get update | |
Remove rules and chains: | |
iptables -F | |
iptables -X | |
iptables -t nat -F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to install rpm packages on Debian and Ubuntu | |
Install alien and all the dependencies it needs: | |
apt-get install alien dpkg-dev debhelper build-essential | |
To convert a package from rpm to debian (.deb) format: | |
alien <package>.rpm | |
Finally, install your package! | |
dpkg -i <package>.deb | |
Source: | |
http://namhuy.net/1207/how-to-install-rpm-packages-on-ubuntu-mint-or-debian.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[global] | |
workgroup = WORKGROUP | |
dns proxy = no | |
log file = /var/log/samba/log.%m | |
max log size = 1000 | |
syslog = 0 | |
panic action = /usr/share/samba/panic-action %d | |
server role = standalone server | |
passdb backend = tdbsam | |
obey pam restrictions = yes | |
unix password sync = yes | |
passwd program = /usr/bin/passwd %u | |
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . | |
pam password change = yes | |
map to guest = bad user | |
usershare allow guests = yes | |
[homes] | |
comment = Home Directories | |
browseable = no | |
read only = yes | |
create mask = 0700 | |
directory mask = 0700 | |
valid users = %S | |
[public] | |
comment = Public Storage | |
path = /mnt/shares/public | |
create mask = 0775 | |
directory mask = 0775 | |
read only = no | |
browseable = yes | |
guest ok = yes | |
writeable = yes | |
available = yes | |
public = yes | |
force user = nobody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Swapping partition numbers | |
-------------------------- | |
This method should let you rewrite the partition table | |
without losing any content on existing partitions. | |
I'm not responsible for any data loss during the process. | |
Example made using a USB thumb drive. (/dev/sdb with sdb1 and sdb2) | |
1. Create a directory for practical purpose | |
mkdir ~/partition-swap | |
2. Output the current partition table | |
sudo sfdisk -d /dev/sdb > sdb.old | |
3. Copy the partition table for future modifications | |
sudo cp sdb.old sdb.new | |
4. Modify the partition table | |
vim sdb.new | |
5. Rewrite the partition table | |
sudo sfdisk --no-reread -f /dev/sdb < sdb.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIM basics | |
------------------ | |
Using tabs (https://www.linux.com/learn/tutorials/442422-vim-tips-using-tabs): | |
vim -p <file> <file> <file> | |
:tabnew <file> | |
:tabn <- next tab | |
:tabp <- previous tab | |
Using splitview (https://www.linux.com/learn/tutorials/442415-vim-tips-using-viewports): | |
:split <file> | |
Change file CTRL+w | |
Copy, cut and paste (http://vim.wikia.com/wiki/Copy,_cut_and_paste): | |
You can use the Visual mode with v. | |
Select your text by navigating with the arrows. | |
y=yank=copy | |
P=past before cursor | |
p=past after cursor | |
d=delete=cut | |
Searching words (http://vim.wikia.com/wiki/Searching): | |
Normal mode type: | |
/<your_word> | |
Forward searching by pressing *(asterisk) | |
Backward searching #(hash sign) | |
Good to know: | |
:w [<file>]<- save/save as | |
:q <- quit | |
:wq <- save and quit | |
:q! <- force quit, losing all changes if not saved | |
gg <- Top of the file | |
SHIFT+G <- Bottom of the file | |
u <- Undo | |
Ctrl+R <- Redo | |
:%!xxd <- Turns ViM into a Hex Editor | |
:%!xxd -r <- Turns ViM back to normal | |
:noh <- clear search highlight from hlsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installation guide XAMPP | |
------------------------ | |
1.Extract the downloaded file to "/opt": | |
# sudo tar xvfz xampp-linux-1.7.7.tar.gz -C /opt | |
2.To start XAMPP simply call this command: | |
# sudo /opt/lampp/lampp start | |
3.Test in your browser if it works: | |
> http://localhost | |
============================= | |
NOT NEEDED FOR DEVELOPMENT !! | |
============================= | |
Missing security in XAMPP | |
------------------------- | |
1.The MySQL administrator (root) has NO password. | |
2.The MySQL daemon is accessible via network. | |
3.ProFTPD uses the password "lampp" for user "nobody". | |
4.PhpMyAdmin is accessible via network. | |
5.Examples are accessible via network. | |
6.MySQL and Apache running under the same user (nobody). | |
To fix most of the security weaknesses: | |
# sudo /opt/lampp/lampp security |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment