設定為 1G
interface 1/0/1
auto-negotiate
speed auto 1000 full-duplex
exit
設定為 10G
no auto-negotiate
speed 10G full-duplex
2018年9月28日 星期五
PHP Sqlite3 筆記
try {
//建立連線
$dbh = new PDO('sqlite:./test.db3');
//建表格
$dbh->exec("CREATE TABLE a(id integer,name varchar(255))");
//增加資料
$dbh->exec("INSERT INTO a values(1,'test')");
$dbh->beginTransaction();
//取得資料
$sth = $dbh->prepare('SELECT * FROM a');
$sth->execute();
//獲取結果
$result = $sth->fetchAll();
print_r($result);
}
catch (PDOException $e)
{ echo 'Connection failed: ' . $e->getMessage(); }
if(isset($dsn)) $dsn=null;
//建立連線
$dbh = new PDO('sqlite:./test.db3');
//建表格
$dbh->exec("CREATE TABLE a(id integer,name varchar(255))");
//增加資料
$dbh->exec("INSERT INTO a values(1,'test')");
$dbh->beginTransaction();
//取得資料
$sth = $dbh->prepare('SELECT * FROM a');
$sth->execute();
//獲取結果
$result = $sth->fetchAll();
print_r($result);
}
catch (PDOException $e)
{ echo 'Connection failed: ' . $e->getMessage(); }
if(isset($dsn)) $dsn=null;
2018年9月25日 星期二
Debian9 設定 Apache 2 HTTPS
載入ssl模組
cd /etc/apache2/mods-enabled
ln -s ../mods-available/ssl.load ssl.load
ln -s ../mods-available/ssl.conf ssl.conf
編輯 /etc/apache2/sites-available/default-ssl.conf
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
設定 SSL
a2ensite default-ssl
a2enmod ssl
systemctl restart apache2
cd /etc/apache2/mods-enabled
ln -s ../mods-available/ssl.load ssl.load
ln -s ../mods-available/ssl.conf ssl.conf
編輯 /etc/apache2/sites-available/default-ssl.conf
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
設定 SSL
a2ensite default-ssl
a2enmod ssl
systemctl restart apache2
2018年9月19日 星期三
LEAF shorewall NAT one to one
增加 /etc/shorewall/nat 192.168.10.42 eth0 192.168.201.1 no no 增加 /etc/shorewall/rules ACCEPT:NFLOG(4) net dmz:192.168.201.1 tcp 22 - 192.168.10.42 ACCEPT:NFLOG(4) net dmz:192.168.201.1 tcp 80 - 192.168.10.42 修改 /etc/shorewall/shorewall.conf ADD_IP_ALIASES=Yes
2018年9月17日 星期一
Debian9 設定PHP7 beast
busybox=/usr/local/bin/busybox
wget -q https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64 -O ${busybox}&&chmod a+x ${busybox}||exit 1
apt-get -y install gcc make php php-dev
wget https://github.com/liexusong/php-beast/archive/master.zip
busybox unzip master.zip
cd php-beast-master
phpize
./configure
make
make install
echo extension=beast.so >>/etc/php/7.0/apache2/php.ini
echo extension=beast.so >>/etc/php/7.0/cli/php.ini
wget -q https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-x86_64 -O ${busybox}&&chmod a+x ${busybox}||exit 1
apt-get -y install gcc make php php-dev
wget https://github.com/liexusong/php-beast/archive/master.zip
busybox unzip master.zip
cd php-beast-master
phpize
./configure
make
make install
echo extension=beast.so >>/etc/php/7.0/apache2/php.ini
echo extension=beast.so >>/etc/php/7.0/cli/php.ini
2018年9月13日 星期四
proxmox 5 移除cluster 資訊
systemctl stop pve-cluster
systemctl stop corosync
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
killall pmxcfs
systemctl start pve-cluster
systemctl stop corosync
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
killall pmxcfs
systemctl start pve-cluster
2018年9月6日 星期四
LEAF Bering-uClibc 6.1.4 ulogd + mariadb server 摘要
1.debian 9 安裝 mariadb server
apt-get install mysql-server ulogd2-mysql
2.開啟 mariadb server 遠端存取
修改 /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
3.設定 mariadb server ulog 設定
echo create database nulog|mysql
cat /usr/share/doc/ulogd2-mysql/mysql-ulogd2.sql.gz |gzip -d |mysql nulog
grant all privileges on nulog.* to nupik@% identified by 'changeme';
flush privileges;
4.LEAF 安裝 ulogd-mysql 套件
apkg -i ulogd-mysql
5.LEAF 修改 ulogd 設定
編輯 /etc/ulogd.conf 加入
/usr/lib/ulogd/ulogd_output_MYSQL.so
stack=log4:NFLOG,base1:BASE,ifi1:IFINDEX,ip2bin1:IP2BIN,mac2str1:HWHDR,mysql1:MYSQL
[mysql1]
db="nulog"
host="192.168.1.1"
user="nupik"
table="ulog"
pass="changeme"
procedure="INSERT_PACKET_FULL"
[mysql2]
db="nulog"
host="192.168.1.1"
user="nupik"
table="conntrack"
pass="changeme"
procedure="INSERT_CT"
apt-get install mysql-server ulogd2-mysql
2.開啟 mariadb server 遠端存取
修改 /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address = 127.0.0.1
3.設定 mariadb server ulog 設定
echo create database nulog|mysql
cat /usr/share/doc/ulogd2-mysql/mysql-ulogd2.sql.gz |gzip -d |mysql nulog
grant all privileges on nulog.* to nupik@% identified by 'changeme';
flush privileges;
4.LEAF 安裝 ulogd-mysql 套件
apkg -i ulogd-mysql
5.LEAF 修改 ulogd 設定
編輯 /etc/ulogd.conf 加入
/usr/lib/ulogd/ulogd_output_MYSQL.so
stack=log4:NFLOG,base1:BASE,ifi1:IFINDEX,ip2bin1:IP2BIN,mac2str1:HWHDR,mysql1:MYSQL
[mysql1]
db="nulog"
host="192.168.1.1"
user="nupik"
table="ulog"
pass="changeme"
procedure="INSERT_PACKET_FULL"
[mysql2]
db="nulog"
host="192.168.1.1"
user="nupik"
table="conntrack"
pass="changeme"
procedure="INSERT_CT"
2018年9月4日 星期二
2018年9月3日 星期一
debian inotify-tools 摘要
安裝
apt-get install inotify-tools incron
加入排程
incrontab -e
相關設定檔
/etc/incron.allow
/etc/incron.conf
/etc/incron.d/
/etc/incron.deny
apt-get install inotify-tools incron
加入排程
incrontab -e
相關設定檔
/etc/incron.allow
/etc/incron.conf
/etc/incron.d/
/etc/incron.deny
dhclient 禁用取得的dns 設定
編輯 /etc/dhcp/dhclient.conf 加入
supersede domain-name-servers 192.168.1.100;
supersede domain-name "aaa.bbb";
其他相關
dhclient 取得 ip 後執行 script
/etc/dhcp/dhclient-exit-hooks.d
supersede domain-name-servers 192.168.1.100;
supersede domain-name "aaa.bbb";
其他相關
dhclient 取得 ip 後執行 script
/etc/dhcp/dhclient-exit-hooks.d
訂閱:
文章 (Atom)