Ubuntu: Difference between revisions
→Mount VMDK file
(→Cleanup old Kernel files: figlet) |
|||
(29 intermediate revisions by the same user not shown) | |||
Line 171:
UUID=467A89307A891DB5 /VM ntfs defaults 0 2
/mnt/folderonyourcomp / cifs username=aman,password=cisco,domain=yourdomain 0 2
===== NFS Mount =====
Source: [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-16-04 digitalocean.com]
{{notice|This section needs to be tested.}}
;On Server side:
Installation
sudo apt-get install nfs-kernel-server
*Make a share directory called nfs:
sudo mkdir /var/nfs/general -p
*NFS will translate any root operations on the client to the nobody:nogroup credentials as a security measure.
*Therefore change the directory ownership to match those credentials:
sudo chown nobody:nogroup /var/nfs/general
*For /home do not change permissions, else it will break down the system.
*Configuring the NFS Exports
sudo nano /etc/exports
/var/nfs/general 203.0.113.256(rw,sync,no_subtree_check)
/home 203.0.113.256(rw,sync,no_root_squash,no_subtree_check)
'''rw:''' This option gives the client computer both read and write access to the volume.
'''sync:''' This option forces NFS to write changes to disk before replying. This results in a more stable and consistent environment since the reply reflects the actual state of the remote volume. However, it also reduces the speed of file operations.
'''no_subtree_check:''' This option prevents subtree checking, which is a process where the host must check whether the file is actually still available in the exported tree for every request. This can cause many problems when a file is renamed while the client has it opened. In almost all cases, it is better to disable subtree checking.
'''no_root_squash:''' By default, NFS translates requests from a root user remotely into a non-privileged user on the server. This was intended as security feature to prevent a root account on the client from using the file system of the host as root. no_root_squash disables this behavior for certain shares.
Restart NFS
sudo systemctl restart nfs-kernel-server
;On Client side:
sudo apt-get install nfs-common
*Edit fstab file:
sudo nano /etc/fstab
10.10.1.30:/home/cores /mnt/cores/ nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp
*Test the mount:
sudo mount -a
==== Different ways to disable IPv6 for network efficiency====
Line 266 ⟶ 309:
How do I go about putting my settings back to default for eth1?
sudo wondershaper clear eth1
==== XRDP on Ubuntu Server ====
Source: [http://c-nergy.be/blog/?p=9433 c-nergy.be]
Additional Packages:
sudo apt-get install x11-xkb-utils
sudo apt-get install pkg-config
Installing Mate Desktop Environment:
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon
Installing XRDP Paackage:
sudo apt-get install xrdp
sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh
sudo systemctl restart xrdp
==== Samba for Windows Sharing ====
Installation:
sudo apt-get install samba
Set a password for your user in Samba
sudo smbpasswd -a <user_name>
Backup current config file:
sudo cp /etc/samba/smb.conf ~
Edit smb.conf file:
sudo nano /etc/samba/smb.conf
[My Files]
Comment = USB Drive on Rpi
path = /media/usbdrive
#valid users = testuser
read only = no
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes
Restart the samba:
sudo service smbd restart
Check your smb.conf for any syntax errors
testparm
To access your network share
sudo apt-get install smbclient
List all shares:
smbclient -L //<HOST_IP_OR_NAME>/<folder_name> -U <user>
Connect:
smbclient //<HOST_IP_OR_NAME>/<folder_name> -U <user>
==== Networking in 17.10 onwards ====
*NetPlan replaces the static interfaces (/etc/network/interfaces) file.
*Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.
*The new interfaces configuration file now live in the /etc/netplan directory.
*A file called 01-netcfg.yaml is used to configured the first interface.
;Below is the default configuration for a interface using DHCP:
<pre>
network:
version: 2
renderer: networkd
ethernets:
ens33:
dhcp4: yes
dhcp6: yes
</pre>
To save your changes, you run the commands below.
sudo netplan apply
;Configuring Static IP Addresses
To configure a static IP address using the new NetPlan tool, the file should look like this:
<pre>
network:
version: 2
renderer: networkd
ethernets:
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.1.2/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
</pre>
Exit and save your changes by running the commands below
sudo netplan apply
===== Networking Service =====
Restarting Networking Service:
sudo systemctl restart networking
sudo systemctl restart networking.service
To verify status:
sudo systemctl status networking.service
===== IP Traffic Forwarding =====
Enable IPv4 Forwarding:
# sudo su
# echo "1" > /proc/sys/net/ipv4/ip_forward
Verify:
# cat /proc/sys/net/ipv4/ip_forward
1
Make the change persistent:
# sysctl -a | grep ip_forward
net.ipv4.ip_forward = 1 ==> Copy this line
# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1 ==> Paste it at the end of this file
IPtables rules:
iptables -t nat -A POSTROUTING -o ens192 -j MASQUERADE
iptables -A FORWARD -i ens193 -o ens192 -j ACCEPT
iptables -A FORWARD -i ens193 -o ens192 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables-save
===Software Centre===
Line 510 ⟶ 682:
|}
=== Beep ===
beep -f 200 -d 1 -r 5 -n -f 300 -d 10 -r 4 -n -f 400 -d 10 -r 3
beep -f 784 -l 600
Line 518 ⟶ 690:
beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460
</pre>
=== Optimize ===
* Remove language related ign from apt-get update:
sudo nano /etc/apt/apt.conf.d/00aptitude
Add the following line at the end of this file:
Acquire::Languages "none";
* Reduce overheating:
You don’t need to do anything after installing TLP. It works in the background.
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
* Install CPUFREQ indicator, Restart your computer and use the Powersave mode in it:
sudo apt-get install indicator-cpufreq
If using Gnome, then goto https://extensions.gnome.org & install extensions.
* Install preload to speed up application load time, restart your computer and forget about it. It will be working in the background:
sudo apt-get install preload
* Manage startup applications
Open Startup Applications & select applications that can be delayed in startup.
Add '''sleep 10;''' in all application commands which you want to delay:
For example, for Dropbox:
dropbox start -i
Changes to
sleep 20; drobox start -i
* This command lists services started at boot-time:
service --status-all
* If you have systemd, use this command to find the services that run at boot time:
sudo systemctl list-unit-files --state=enabled
* Check If Your Hard Drive Is Overworking
sudo apt install iotop
* Use Bootchart to find out slow services/processes:
systemd-analyze time
systemd-analyze blame
systemd-analyze plot > bootchart.svg
* Slow boot due to nonexistent swap partition [https://askubuntu.com/questions/1030867/ubuntu-18-04-how-to-diagnose-fix-very-slow-boot askubuntu.com]:
At some point during the upgrade, the initramfs config was modified, adding a line pointing to a nonexistent swap partition.
The slow boot was because it was looking for this partition and then timing out after 30 seconds.
sudo nano /etc/default/grub
Add '''noresume''' to the below line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noresume"
sudo update-grub
sudo reboot
===Miscellaneous===
Line 858 ⟶ 1,091:
echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
==== FIGlet ====
Source: [http://www.shellhacks.com/en/Creating-ASCII-Text-Banners-from-the-Linux-Command-Line shellhacks.com]
Install and run FIGlet
sudo apt-get install figlet
figlet "Shell Hacks"
Change Fonts
figlet -f digital "Shell Hacks"
If you would prefer centered output
Line 886 ⟶ 1,120:
You can alter the complete MOTD message from below files:
/etc/update-motd.d/
==== Mount VMDK file ====
Source: [https://stackoverflow.com/questions/22327728/mounting-vmdk-disk-image stackoverflow.com]
Installation:
sudo apt install libguestfs-tools
Check Disks & partitions
sudo lsblk
Create Mount point:
sudo mkdir /mnt/vmdk
Mount the VMDK Image:
sudo guestmount -a pro_nlb_avi-se-02old-disk1.vmdk -m /dev/sda3 --ro /mnt/vmdk
cd /mnt/vmdk
Unmount the image:
sudo guestunmount /mnt/vmdk
==== Thumbnails for Media ====
Install Thumbnail applications
sudo apt install ffmpegthumbnailer
sudo apt install gstreamer1.0-libav
Clear the cache
rm -r ~/.cache/thumbnails/fail
Or
rm -rf ~/.cache/thumbnails/*
<br />
|