Skip to content

Instantly share code, notes, and snippets.

@sfloess
Last active March 25, 2024 13:51
Show Gist options
  • Save sfloess/5efbbf1c69e481e4f449ab28cbf896bb to your computer and use it in GitHub Desktop.
Save sfloess/5efbbf1c69e481e4f449ab28cbf896bb to your computer and use it in GitHub Desktop.
*nix

Common *nix Tips and Tricks

Window Managers

dnsmasq

Using multiple DNS servers

To use multiple DNS servers, when defining your dhcp-host, define a set name and tag:

  • Set: dhcp-host=[mac address],[hostname],[ip address],[duration],set:[set/tag name]
  • Tag: dhcp-option=tag:[tag/set name],option:dns-server,[DNS server IP address]

Example:

  • Set: dhcp-host=4c:72:b9:94:a9:c1,server-01,192.168.168.31,infinite,set:cloud
  • Tag: dhcp-option=tag:cloud,option:dns-server,192.168.168.3

Misc

ddclient

How to configure namecheap.

Please note: The ddns password is found in the web UI https://ap.www.namecheap.com/Domains/DomainControlPanel/[domain name]/advancedns. Grep for Dynamic DNS Password.

  • /etc/ddclient.conf
ssl=yes
domain=300
use=web, web=https://dynamicdns.park-your-domain.com/getip
protocol=namecheap                                                                                                     
login=[your domainname]                                                            
password=[Dynamic DNS Password]                                               
[host]

Example:

ssl=yes
domain=300
use=web, web=https://dynamicdns.park-your-domain.com/getip                                                                      
protocol=namecheap                                                                                                     
login=flossware.org                                                                                                    
password=abcdefghijklmnopqrstuvwxyz1234567890                                                                              
services

Apache HTTP Server

Database

Postgres

  • ${POSTGRES_CONF_HOME}/postgresql.conf
    • listen_addresses = '*'
  • ${POSTGRES_CONF_HOME}/pg_hba.conf
    • host all all 192.168.168.0/24 password
  • Initialize
    • [init script] initdb
    • service postgresql initdb
  • Create user/database:
    • su - postgres
    • psql
    • CREATE USER [username] WITH PASSWORD '[password]';
    • CREATE DATABASE [database];
    • GRANT ALL PRIVILEGES ON DATABASE [database] to [user];

Maria DB

  • ${MARIA_CONF_HOME}/conf.d/*server*.cnf
    • bind-address = 0.0.0.0
    • user = mysql
  • Create user/database:
    • mysql
    • CREATE USER '[user]' IDENTIFIED BY '[password]';
    • GRANT USAGE ON *.* TO '[user]'@'%' IDENTIFIED BY '[password]';
    • FLUSH PRIVILEGES;

Messaging

Apache ActiveMQ

  • ${ACTIVEMQ_HOME}/conf/jetty.xml
    • <property name="host" value="0.0.0.0"/>
  • ${ACTIVEMQ_HOME}/conf/activemq.xml
    • <broker xmlns="http://activemq.apache.org/schema/core" brokerName="FlossWare" dataDirectory="${activemq.data}">

Postgres Persistence

    <bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">                                       
        <property name="serverName" value=""/>                                                          
        <property name="databaseName" value=""/>                                                     
        <property name="portNumber" value="0"/>                                                                 
        <property name="user" value=""/>                                                                
        <property name="password" value=""/>                                                   
        <property name="dataSourceName" value=""/>                                                      
        <property name="initialConnections" value="1"/>                                                         
        <property name="maxConnections" value="10"/>                                                            
    </bean>

Postfix

Nexus

Uploading to a Debian Repo

for aFile in [fully qualified path]/*deb
do
    echo "    `basename ${aFile}`"

    curl -k -u [username]:[password] -H "Content-Type: multipart/form-data" --data-binary  "@/.${aFile}" http://[host]:[port]/repository/[debian repo name]/
done

Uploading to a Yum Repo

for aFile in [fully qualified path]/*rpm
do
    echo "    `basename ${aFile}`"

    curl -k -u [username]:[password] --upload-file ${aFile} http://[host]:[port]/repository/[yum repo name]/`basename ${aFile}`
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment