Sometimes you have a config file with a lot of comments and empty lines, which you don’t need, because they hide the relevant information. So use this to simplify it:
cat your.file | grep -v '^#' | grep -v '^$'
Sometimes you have a config file with a lot of comments and empty lines, which you don’t need, because they hide the relevant information. So use this to simplify it:
cat your.file | grep -v '^#' | grep -v '^$'
Reload firewall settings
firewall-cmd --reload
Bind an interface “eth0” to the default zone.
firewall-cmd --add-interface=eth0 --permanent
Bind an interface “eth0” to a specific zone “public”
firewall-cmd --zone=public --add-interface=eth0 --permanent
Add a service to default zone
firewall-cmd --add-service https --permanent
Add a service to a specific zone “public”
firewall-cmd --zone=public --add-service https --permanent
Open a port within the default zone
firewall-cmd --add-port 1521/tcp --permanent
Open a port within a specific zone “public”
firewall-cmd --zone=public --add-port 1521/tcp --permanent
Remove a port from a specific zone “public”
firewall-cmd --remove-port 1521/tcp --permanent
List all defined zones
firewall-cmd --get-zones
Get the default zone
firewall-cmd --get-default-zone
List active zones
firewall-cmd --get-active-zones
Get data of a specific zone “public”
firewall-cmd --info-zone=public
To authenticate with keys on an SSH session, we need a keypair first. This contains a public and a private key part. The public part must be copied to the SSH server, the private part resides on your user homedir.
ssh-keygen -t rsa -b 4096
This will ask you for the destination of the keyfiles. The file with the extension .pub will be the public key part.
Enter file in which to save the key (/home/<user>/.ssh/id_rsa):
You can leave the default (press Enter-key), of type another file name, i.e. my-ssh-key. Without a path it will be stored into the current working directory. Now you should secure your private key with an additional keyphrase, which you have to enter on every access to the key. Type it twice and don't forget it. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in my-ssh-key Your public key has been saved in my-ssh-key.pub The key fingerprint is: SHA256:Kg4elHNG8TwLIYjTfX7yRz7h0dmVHY7FUx5krwwQjEA user@hostname The key's randomart image is: +---[RSA 4096]----+ |.o..+E. o. o++| |+ ...=.. .. .+oo| | . oo+ . . *.= | | o .oo. = o * | | + o .+S+ + o | | . + .. = o . | | o . . . . o | | . + . | | . . | +----[SHA256]-----+
You can move both files into /home/<user>/.ssh/. If the folder doesn’t exist, create it:
mkdir -p ~/.ssh chmod 700 ~/.ssh mv my-ssh-key ~/.ssh/. chmod 600 ~/.ssh/my-ssh-key chmod 644 ~/.ssh/my-ssh-key.pub
The file permission must be set correctly. Now its time to copy the public key part to the SSH server. You need a working user account there, which can bee reached with a password login.
ssh-copy-id -i ~/.ssh/my-ssh-key user@ssh-hostname
This will copy the content of the my-ssh-key.pub into ~/.ssh/authorized_keys on the SSH server. If you don’t have access to the account (because the SSH server prevents password-based login), ask your administrator. If your keybased login doesn’t work, try on client side
ssh -vvv user@ssh-hostname
to see, what’s going on. It tries some private key names, but the name my-ssh-key (see above) will not used. So we have to configure this in a special file named “config” within ~/.ssh.
cd ~/.ssh touch config chmod 644 config
type some SSH parameters into that file.
host <ssh-hostname> Hostname <ssh-hostname> Port 22 IdentityFile ~/.ssh/my-ssh-key ForwardX11 yes
Replace <ssh-hostname> with the correct name. The important part is IdentityFile, which points to your SSH private key part. ForwardX11 is optional and allows a display redirection from the server to the client for X-based applications. Save the file and try it again:
ssh user@ssh-hostname
This should now ask for the passphrase of the correct key my-ssh-key.
Enter passphrase for key '/home/<user>/.ssh/my-ssh-key':
Get the child element nodes of a book node (without comment nodes and text nodes)
//book/*
Get the child elements, text and comment nodes of a book node
//book/*|text()|comment()
The following XPath queries return the same nodes:
$xpath->query("./../bookstore", $contextNode)
$xpath->query("../bookstore", $contextNode);
To find all running hosts within a subnet, you can ping it with fping:
fping -s -g 192.168.1.1 192.168.1.254 2>/dev/null | grep "is alive"
rpm -ivh oracle-instantclient-basic-linux.XXX.rpm
rpm -ivh oracle-instantclient-devel-linux.XXX.rpm
yum install php-pear php-devel zlib zlib-devel bc libaio glibc
yum groupinstall "Development Tools"
ln -s /usr/include/oracle/XXX/client64 /usr/include/oracle/XXX/client
ln -s /usr/lib/oracle/XXX/client64 /usr/lib/oracle/XXX/client
mkdir /opt/iclient
Create a file inside /etc/profile.d named oracle.sh and put this as the content:
export LD_LIBRARY_PATH=/usr/lib/oracle/XXX/client64/lib:${LD_LIBRARY_PATH}
export TNS_ADMIN=/opt/iclient
export NLS_LANG=GERMAN_GERMANY.UTF8
export SQLPATH=/usr/lib/oracle/XXX/client64/lib:${SQLPATH}
And run it so we’ll have LD_LIBRARY_PATH as an environment variable.
source /etc/profile.d/oracle.sh
Use ‘oci8’ to install for PHP 8.
Use ‘oci8-2.2.0’ to install for PHP7
Use ‘oci8-2.0.12’ to install for PHP 5.2 – PHP 5.6.
Use ‘oci8-1.4.10’ to install for PHP 4.3.9 – PHP 5.1.
The OCI8 extension can be linked with Oracle client libraries from Oracle Database 19.9, 12.2, 12.1, 11, or 10.2.
pear download pecl/oci8-2.0.12
tar -xvf oci8-2.0.12.tgz
cd oci8-2.0.12
phpize ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/XXX/client64/lib
./configure --with-oci8=shared,instantclient,/usr/lib/oracle/XXX/client64/lib
make
make install
If you run into such an error:
error: oci8_dtrace_gen.h: No such file or directory
try to solve it with Stackoverflow:26145605.
To enable the extension, add a file named oci8.ini in /etc/php.d with this content:
extension=oci8.so
Restart Apache Webserver.
Copy your tnsnames.ora and sqlnet.ora to /opt/iclient.
I have an old laptop with Ubuntu 15.x and bought a new SSD to speedup the system a little bit. To copy the whole system from the HDD to the SSD you need to align the new partition on sector numbers which are dividable by 4096. So I have to create a primary partition starting on sector 4096 of the SSD and a Linux Swap partition. Use gparted and check the sector numbers twice.
To copy the existing data I found an article, which uses rsync:
rsync -rvlpogdstHEAX /hdd/ /ssd
It copies the Grub too, but in my case, the Grub uses UUIDs, which differ between HDD and SSD. So I have to change the grub.cfg manually:
chmod 644 /boot/grub/grub.cfg vim /boot/grub/grub.cfg
Use now the vim replace function:
:%s/old-uuid/new-uuid/g
It replaces all occurrences of old-uuid with new-uuid. Then you need to open /etc/fstab and replace the UUIDs for the primary partition and the Swap partition too.
Install the SSD on the computer and start it, it boots your old system.
tcpdump -nnvvS host <ip-address>
To look into the data packet add the -X switch:
tcpdump -nnvvXS host <ip-address>