POSTFIX UBUNTU 18.04

POSTFIX 強制開啟郵件加密的功能,解除GMAIL的未加密的安全警示.

編輯postfix 的設定檔.
vi /etc/postfix/main.cf

#加入下語法
smtpd_tls_security_level = may
smtp_tls_security_level = may

上面的語法會對對方支援加密的條件下,優先加密發送經過TLS加密的信件.但是當對方伺服器無加密功能時也不會強制退件.

Ubuntu 18.04/19.04 安裝Draw.io 好用的繪圖軟體 (也有WINDOWS和MAC)

draw.io 是一個非常好用的繪圖軟體.他提供了非常多常用的ICON用來設計圖,使用上非常的直覺.他也提供了離線版本:
https://github.com/jgraph/drawio-desktop/releases
這裡有持續更新的最新版本 /你可以在這裡下載到 Windows Installer, Window No Installer, Mac, Linux – deb, snap, AppImage or rpm 的幾種安裝格式.

Ubuntu提供snap版本的

在 snap 上安裝--

sudo snap install drawio --edge

uBuntu 19.04 /rc.local 重建手術

最近把家裡的centos 7伺服器改成了新19.04版本的,但是發現完全找不到開機執行的RC.LOCAL 檔,只好自行重建了

1.建立一個rc.local 服務

sudo vi /etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

完成後存檔記錄.

1.建立一個/etc/rc.local 檔

sudo touch /etc/rc.local
sudo chmod +x /etc/rc.local

sudo vi /etc/rc.local

加入預設的啟動SHELL內容:
#!/bin/sh -e

exit 0;

3.建立開機時的執行服務啟動

sudo systemctl enable rc-local

重新啟動電腦就完成設置了.


樹苺派BUSTER (DEBIAN 10) 安裝PHP7.3 +LARAVEL+RASPBERRYPI

樹苺派在2019年升級到了新的debian 10 也提供了新版本的php 使用,所以我們今天就針對php版本重新進行安裝,基本的laravel的環境.

安裝 php-7.3 及php_fpm

sudo apt install php7.3 php7.3-curl php7.3-gd php7.3-imap php7.3-json php7.3-mysql php7.3-opcache php7.3-xmlrpc php7.3-xml php7.3-fpm php7.3-zip php7.3-mbstring php7.3-sqlite3 php7.3-cli php7.3-readline -y



修改PHP7.3-FPM 使用者改為PI

vi /etc/php/7.3/fpm/pool.d/www.conf
#—-以下內容修改
#把 www-data 改成pi
;user = www-data
;group = www-data

user = pi
group = pi

###
;listen.owner = www-data
;listen.group = www-data
改成
listen.owner = pi
listen.group = pi

啟動PHP7.3-FPM

service php7.3-fpm start
systemctl enable php7.3-fpm


安裝Composer

sudo apt-get install composer




安裝 nodejs 和 npm

sudo apt-get install nodejs
sudo apt-get install npm


因為laravel需要用到nodejs所以安裝這些套件

安裝NIGNX HTTPD 伺服器

sudo apt-get install nginx


設定 nginx 的使用者為pi

sudo vi /etc/nginx/nginx.conf

#user www-data;
user pi;


修改預設的伺服器的php

sudo vi /etc/nginx/sites-available/default

    #
    #location ~ \.php$ {
    #       include snippets/fastcgi-php.conf;
    #
    #       # With php-fpm (or other unix sockets):
    #       fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    #       # With php-cgi (or other tcp sockets):
    #       fastcgi_pass 127.0.0.1:9000;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
#
location ~ \.php$ {
       include snippets/fastcgi-php.conf;
#
#       # With php-fpm (or other unix sockets):
       fastcgi_pass unix:/run/php/php7.3-fpm.sock;
#       # With php-cgi (or other tcp sockets):
#       fastcgi_pass 127.0.0.1:9000;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
       deny all;
}

啟動NGINX

sudo serivce nginx start
sudo systemctl enable nginx

安裝laravel

composer create-project laravel/laravel laravel –prefer-dist
生成的laravel目錄會放置於/home/pi/laravel

設定nginx目錄指向laravel

sudo vi /etc/nginx/sites-available/default

#原始內容
    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;
#更改為以下內容    
root /home/pi/laravel/public;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

重新啟動NGINX

sudo serivce nginx start


打完收功

Raspberrypi 樹苺派設定固定IP

前言

樹苺派設定固定IP的方式:

啟動eth0的網路

vi /etc/network/interfaces.d/eth0

#auto eth0 是啟動!!!
auto eth0
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 168.95.1.1 8.8.8.8

DNS 設定: (一般首次設定時會)

vi /etc/reslove.conf

nameserver 168.95.1.1
nameserver 8.8.8.8

多重網路開啟時:

如果要同時開立無線網路/及有線網路時要指定default gateway

sudo route add default gw 192.168.1.1









Raspberry Pi Install Laravel php Nginx

安裝樹苺派的PHP+LARAVEL+NGINX

Install PHP 7.0

sudo apt install php7.0 php7.0-curl php7.0-gd php7.0-imap php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-xmlrpc php7.0-xml php7.0-fpm php7.0-zip php7.0-mbstring php7.0-sqlite3 php7.0-cli php7.0-readline -y


START php7.0-fpm

sudo systemctl enable php7.0-fpm
sudo service php7.0-fpm start


Install Composer

sudo apt-get install composer



Install NODEJS

sudo apt-get install npm


INSTALL NGINX

sudo apt-get install nginx


Create laravel

composer create-project laravel/laravel laravel –prefer-dist

sudo vi /etc/nginx/sites-enabled/default

################################
#root /var/www/html;
root /home/pi/laravel/public;

#Add index.php to the list if you are using PHP#index index.html index.htm index.nginx-debian.html;
index index.php index.html index.htm index.nginx-debian.html;
 
location ~ .php$ {
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 
}
location ~ /\.ht {             
    deny all;     
}

SETUP SERVICE

sudo service nginx restart
sudo systemctl enable nginx

打完收功

MAIL SERVER寄送信件一直出現MX錯誤! 原來是: /etc/resolv.conf

設定 /etc/resolv.conf 檔案

之前的舊伺服器重新開機後一直出現MX not found總覺得那裡怪怪的.

後來原來是因為在伺服器重開之後name server 查詢伺服器異常.

更改了/etc/resolv.conf 才能夠發信件.

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 168.95.1.1
nameserver 168.95.2.1

ubuntu 18.04 youtube-dl not work

最近想要把自己家裡的音樂機器人升級一下,發現了居然已經不會自動下載Youtube的音樂檔了,測試了一下才發現youtube-dl好像已經失效了,果然Google Youtube 不是省油的GOOGLE,只好再把 Youtube-DL 下載最近的版本.

 

要將youtube升級到最新版本:

sudo pip3 install –upgrade youtube-dl


 

安裝SCRATCH 2.0的方法 18.04 UBUNTU

安裝SCRATCH 2.0 OFFLINE在UBUNTU 18.04

# install necesary i386 libraries
sudo apt-get install libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386

sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0

wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRSDK.tbz2
sudo mkdir /opt/adobe-air-sdk
sudo tar jxf AdobeAIRSDK.tbz2 -C /opt/adobe-air-sdk


wget https://aur.archlinux.org/cgit/aur.git/snapshot/adobe-air.tar.gz
sudo tar xvf adobe-air.tar.gz -C /opt/adobe-air-sdk
sudo chmod +x /opt/adobe-air-sdk/adobe-air/adobe-air

https://scratch.mit.edu/scratch2download/
sudo mkdir /opt/adobe-air-sdk/scratch
wget https://scratch.mit.edu/scratchr2/static/sa/Scratch-456.0.1.air
sudo cp Scratch-456.0.1.air /opt/adobe-air-sdk/scratch/
cp Scratch-456.0.1.air /tmp/
cd /tmp/
unzip /tmp/Scratch-456.0.1.air
sudo cp /tmp/icons/AppIcon128.png /opt/adobe-air-sdk/scratch/scratch.png

Create launcher:

$ cat << _EOF_ > /usr/share/applications/Scratch2.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/Scratch-456.0.1.air
Icon=/opt/adobe-air-sdk/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project
_EOF_

$ chmod +x /usr/share/applications/Scratch2.desktop

And that’s it. First run is a little bit longer, as the Air is unpacking Scratch 2 application to ~/.appdata/edu.media.mit.Scratch2Editor folder.

原文:

https://askubuntu.com/questions/913892/how-to-install-scratch-2-on-ubuntu-16-10-or-17-04-64bit