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':
I have tried to install a running development environment for WebObjects applications on Linux (OpenSuse 15.4 and Xubuntu 18.04). There are some little problems to solve.
Let’s start with the installations.
zypper install java-1_8_0-openjdk java-1_8_0-openjdk-devel java-1_8_0-openjdk-javadoc java-1_8_0-openjdk-src java-1_8_0-openjdk-headless java-1_8_0-openjdk-demo zypper install ant apt install openjdk-8-jdk openjdk-8-demo openjdk-8-doc openjdk-8-headless openjdk-8-source apt install ant
Now you have to download the Eclipse IDE (for Java Developers or for Enterprise Java and Web Developers).
https://www.eclipse.org/downloads/packages/
You can install it on /opt (extract the tar.gz there).
I have installed the WebObjects stuff into its own folder called “WODevelopment” within your home folder. There is also the preferred workspace folder for Eclipse.
cd ~ mkdir -p WODevelopment/workspace
Start the IDE with this workspace folder to see any problems. Maybe you have to install some more things you need, like Subclipse.
Now you install the WOLips plugin into Eclipse. Go to Help->Install New Software->Add and create a new location.
WOLips410 https://jenkins.wocommunity.org/job/WOLips410/lastSuccessfulBuild/artifact/temp/dist/
Select all options (the WOLips Goodies are not installable on Linux) and install them. After an IDE restart, you can open a new perspective “WOLips”.
The plugin needs a lot of WebObjects frameworks, which you have to install now. Actually there is an install tool, called WOInstaller, but this doesn’t work for me, it always stops with an exception message. I have tried two versions and end up with a manual installation.
curl -O https://jenkins.wocommunity.org/job/WOInstaller/lastSuccessfulBuild/artifact/Utilities/WOInstall/WOInstaller.jar curl -O https://wocommunity.org/documents/tools/WOInstaller.jar java -jar WOInstaller.jar 5.4.3 ~/WODevelopment/Libraries/WOnder
If you get also an exception, try the following.
You will find a folder “WebObjects Update/Packages”, which contains four further archives (.pkg). These archive files you can also decompress with 7-zip. It generates a “Payload~” archive, which you decompress again.
7z x WebObjectsDevelopment.pkg 7z x Payload~ rm Payload~ 7z x WebObjectsDocumentation.pkg 7z x Payload~ rm Payload~ 7z x WebObjectsExamples.pkg 7z x Payload~ rm Payload~ 7z x WebObjectsRuntime.pkg 7z x Payload~ rm Payload~
Now you have three folders (Developer, Library, System), which you copy into “~/WODevelopment/Libraries/WOnder”.
mkdir -p ~/WODevelopment/Libraries/WOnder mv Developer ~/WODevelopment/Libraries/WOnder/. mv Library ~/WODevelopment/Libraries/WOnder/. mv System ~/WODevelopment/Libraries/WOnder/.
Check the owner of the files and use “chown” if necessary.
Now its time for the global wolips properties file, which contains some settings for the Eclipse plugin and the ANT build pipeline. The file must be on “~/Library/Application Support/WOLips/wolips.properties”.
mkdir -p "~/Library/Application Support/WOLips" touch wolips.properties
Edit the newly generated file and copy the following properties into it. Change the path prefixes, as necessary, i.e. /home/me/WODevelopment. Don’t use Shortcuts like “~”. Be careful, every path must exist within the filesystem, generate them, if necessary.
wo.system.frameworks=/home/me/WODevelopment/Libraries/WOnder/System/Library/Frameworks wo.bootstrapjar=/home/me/WODevelopment/Libraries/WOnder/System/Library/WebObjects/JavaApplications/wotaskd.woa/WOBootstrap.jar wo.extensions=/home/me/WODevelopment/Libraries/WOnder/Library/WebObjects/Extensions wolips.properties=wolips.properties wo.system.root=/home/me/WODevelopment/Libraries/WOnder/System wo.user.frameworks=/home/me/Library/Frameworks wo.external.root=/home/me/WODevelopment/Libraries/WOnder/External wo.local.root=/home/me/WODevelopment/Libraries/WOnder wo.apps.root=/home/me/WODevelopment/Libraries/WOnder/Library/WebObjects/Applications wo.api.root=/home/me/WODevelopment/Libraries/WOnder/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.WebObjectsReference.docset/Contents/Resources/Documents/documentation/MacOSXServer/Reference/WO54_Reference wo.local.frameworks=/home/me/WODevelopment/Libraries/WOnder/Library/Frameworks wo.network.root=/home/me/WODevelopment/Libraries/WOnder/Network wo.network.frameworks=/home/me/WODevelopment/Libraries/WOnder/Network/Library/Frameworks wo.user.root=/home/me wo.server.root=/home/me/WODevelopment/Libraries/WOnder/Server
The last step is the download and the build of the WOnder source code, the current community extensions to WebObjects.
Go to the GITHUB repository of “WOnder” and download the latest release as ZIP archive.
https://github.com/wocommunity/wonder/releases/latest
Extract the downloaded archive file into the “~/WODevelopment/WonderSource”. Use the tar.gz instead of zip, there is a problem with long filenames.
tar xvzf ~/Downloads/wonder-<version>.tar.gz mv ~/Downloads/wonder-wonder-<version> ~/WODevelopment/WonderSource
Copy the “wolips.properties” file as “build.properties” into “~/WODevelopment/WonderSource”. It is the config for the following ANT build process.
cd ~/WODevelopment/WonderSource cp ~/Library/Application Support/WOLips/wolips.properties build.properties
Start the build with JDK1.8 (!). There can be some warnings, but it should end with “BUILD SUCCESSFUL”.
JAVA_HOME=<path to JDK1.8> ant all
Now you can start WebObjects development of your own project within Eclipse. The projects within Eclipse should use Java 1.8 within its Build Path, add this JRE as installed VM.
If you start the first project, you will get an error, that the application cannot be opened within the default browser. Linux is not a supported development platform. So you have to add a special method within your Application.java file:
@Override
public boolean _isSupportedDevelopmentPlatform() {
return super._isSupportedDevelopmentPlatform() || "Linux".equals(System.getProperty("os.name"));
}
After that, WOLips will call /usr/bin/open to execute the dynamic application URI within the default browser. But this will not work within Linux, but you can define a symbolic link (as root) to your preferred browser:
cd /usr/bin ln -s /usr/bin/firefox open
Now the browser should automatically display your application within Firefox.
You can convert a multipage PDF into multiple PNG files with a simple Bash statement:
convert -density 300 your.pdf -quality 100 -scale 825x1125 your-%d.png
Now you can change the images with a simple GFX application like Kolourpaint. You can also create new images with the same size and reorder your images by the number within the filename.
After you have finished your work, recombine the PNGs into a PDF:
convert your-*.png your-new.pdf
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"
On a Linux with SystemD you can use the following service file (Derby has been installed on /opt/db-derby-10.13.1.1-bin):
[Unit] Description=Apache Derby Database Network Server After=network.target [Service] Type=simple Environment=CLASSPATH=/opt/db-derby-10.13.1.1-bin/lib/derby.jar:/opt/db-derby-10.13.1.1-bin/lib/derbynet.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_cs.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_de_DE.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_es.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_fr.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_hu.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_it.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_ja_JP.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_ko_KR.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_pl.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_pt_BR.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_ru.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_zh_CN.jar:/opt/db-derby-10.13.1.1-bin/lib/derbyLocale_zh_TW.jar WorkingDirectory=/var/lib/derby StandardOutput=syslog User=andre ExecStart=/usr/bin/java -Dderby.system.home=/var/lib/derby org.apache.derby.drda.NetworkServerControl start ExecStop=/usr/bin/java -Dderby.system.home=/var/lib/derby org.apache.derby.drda.NetworkServerControl shutdown [Install] WantedBy=multi-user.target
Copy this file to /usr/lib/systemd/system as apache-derby.service and execute as root:
# systemctl enable apache-derby.service # systemctl start apache-derby.service
The databases will be generated at /var/lib/derby.
To test the Derby server start the ij
tool:
# cd /opt/db-derby-10.13.1.1-bin/bin # ij CONNECT 'jdbc:derby://localhome:1527/atest;create=true';
The database atest should be generated within /var/lib/derby/atest. If there is an error, check your apache-derby service and your local firewall (open port 1527).
To use the database server within EOModeler you can set:
database url: jdbc:derby://<server>:1527/<database name> JDBC library: derbyclient.jar JDBC driver class: org.apache.derby.jdbc.ClientDriver
User Management
Per default Derby doesn’t need an user to access a database. To enable user authentication you should add an user with full access to the database:
# ij CONNECT 'jdbc:derby://localhome:1527/atest'; CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.<an username>', '<a password>'); CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.fullAccessUsers', '<an username>'); CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.connection.requireAuthentication', 'true'); EXIT;
If you define an user, you will have to enable the authentication mode for Derby too. Restart the apache-derby.service to enable the authentication after the calls above. Now it is necessary to provide username and password for this specific database “atest” within EOModeler.
The new JDBC url toconnect with ij would be:
CONNECT 'jdbc:derby://<server>:1527/<database name>;user=<username>;password=<secret>';
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.