mathz.nu Asterisk Blacklist Hobby webbhotell

2016/02/06

Bacula reset Tape

Filed under: Backup,Server — Mathz @ 22:20

If
3920 Cannot label Volume because it is already labeled: “TAPE123”

 

sudo bconsole
* umount

 

Load Tape from Slot 1 to device
/etc/bacula/script/mtx-changer /dev/sg4 load 1 /dev/st0 0
mt -f /dev/nst0 rewind
mt -f /dev/nst0 weof
mt -f /dev/nst0 rewind

sudo bconsole
label
update slots
* list media

sudo mtx -f /dev/sg5 status
Load slot 1
sudo mtx -f /dev/sg5 load 1

lsscsi -g
use /dev/sgX for changer
use /dev/stX for drive

Label to Scratch
bconsole
*label pool=Scratch storage=DigitalTapeLibrary slot=2

2016/02/01

Install Java 1.8 on Redhat

Filed under: Programering,Server — Mathz @ 13:25

yum install java-1.8.0-openjdk
yum install java-1.8.0-openjdk-devel
cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.el6_7.x86_64/jre/bin/
alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.el6_7.x86_64/jre/bin/java 2
alternatives --config java

2016/01/28

Java 1.8 on Ubuntu 14.04 LTS

Filed under: Server — Mathz @ 10:15

sudo apt-get install python-software-properties (sudo apt-get install --reinstall software-properties-common)
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac

 

Solve missing /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts

sudo dpkg purge forcedepends cacertificatesjava
sudo aptget install cacertificatesjava

2015/10/25

Cpanel backup

Filed under: Server — Mathz @ 21:35

If you want to move one account use:

/scripts/pkgacct accountname

This creates a backup of the account at the top level of /home which you can copy over to another server into /home and restore using:

/scripts/restorepkg accountname

2015/09/21

Install OpenLDAP on Ubuntu 14.04

Filed under: LDAP — Mathz @ 13:11

Install

apt-get update
apt-get install slapd ldap-utils

Set password for admin

Configure

vim /etc/ldap/ldap.conf (not existing)


#
# LDAP Defaults
#

# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE dc=example,dc=com
URI ldap://10.10.0.100 ldap://10.10.0.100:389

#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never

# TLS certificates (needed for GnuTLS)
TLS_CACERT /etc/ssl/certs/ca-certificates.crt

Start reconfigure

dpkg-reconfigure slapd

Omit OpenLDAP server config: No
DNS domain name: example.com
Orgianization name: MyCompany
Administrato password:
Database backend to use: HDB
Do you want the database to be removed when slapd is purged: Yes
Move old database: Yes (backup of database)
Allow LDAPv2 protocol: No

Now you can see your config

ldapsearch -x

2015/08/20

MySQL JDBC Connection in Glassfish

Filed under: Glassfish — Mathz @ 19:50

Start to add a new JDBC Connection Pools.

* Goto Resources-> JDBC -> JDBC Connection Pools
* Click New…
* Enter a pool name (identyfy the pool, free text)
* Choose java.sql.Driver
* Click Next
* Enter com.mysql.jdbc.Driver in Driver Classname
* Add additional properties:

Name Value
URL jdbc:mysql://localhost:3306/<databaseName>?zeroDateTimeBehavior=convertToNull
user <username>
password <password>

* Click on finish

 

Create a new JDBC Resource
* Goto Resources-> JDBC -> JDBC Resources
* Click New…
* Enter jdbc/ as JNDI Name
* Choose the Pool the you created above as Pool Name
* Click OK

Download mysql-connector-java-.jar to the glassfish4/glassfish/lib mapp (https://dev.mysql.com/downloads/connector/j/5.0.html)

2015/07/11

Ubuntu autostart Glassfish

Filed under: Glassfish,Ubuntu — Mathz @ 15:09

You need to set JAVA_HOME and add JAVA_HOME/bin to PATH


asadmin create-service

2015/06/11

Postgres database dump

Filed under: Postgresql — Mathz @ 07:10

To export schema from postgres database use:

pg_dump -s databasename

2015/06/04

MemberOf LDAP Ubuntu

Filed under: LDAP,Server — Mathz @ 21:12

The first LDIF file:


dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulePath: /usr/lib/ldap
olcModuleLoad: memberof

Second LDIF file:

dn: olcOverlay=memberof,olcDatabase={1}hdb,cn=config
objectClass: olcMemberOf
objectClass: olcOverlayConfig
objectClass: olcConfig
objectClass: top
olcOverlay: memberof
olcMemberOfDangling: ignore
olcMemberOfRefInt: TRUE
olcMemberOfGroupOC: groupOfNames
olcMemberOfMemberAD: member
olcMemberOfMemberOfAD: memberOf

Add them into the config database using ldapadd (same as normal config stuff).

It does not automatically update the existing data in the database, so I needed to use slapcat to copy everything out into a temporary file, and visit each group, delete the group and add the same group back in again (forces the memberOf attributes to update correctly). If you are starting with an empty database, then it will correctly update the attributes as objects are added.

Also, note that “olcDatabase={1}hdb” is very typical, but not guaranteed to match your setup. Be sure to check that one.

2015/05/19

Postgres on Ubuntu 14.04

Filed under: Postgresql,Server — Mathz @ 15:26

Install postgres 9.4
Add source
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'

add key
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -

update
sudo apt-get update

install
sudo apt-get install postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib

Add user
# sudo su - postgres
$ createdb mydb
$ psql -s mydb
# create user someuser password 'somepassword';
# GRANT ALL PRIVILEGES ON DATABASE mydb TO someuser;

Enable PostGIS

#sudo su - postgres
#psql
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;

To verify
\dx postgis*

Restore backup
psql database < file

Nice to know commands

mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;

mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

mysql: DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

« Newer PostsOlder Posts »

Powered by WordPress