CODESHIF - Linux Linux技巧 2020-01-02T21:59:00+08:00 Typecho http://codeshif.com/feed/atom/category/linux/ <![CDATA[Linux Ubuntu Wine Photoshop CS6]]> http://codeshif.com/archives/41.html 2020-01-02T21:59:00+08:00 2020-01-02T21:59:00+08:00 admin https://www.codeshif.com Linux Ubuntu Wine Photoshop CS6

1、注意事项

Wine无法直接使用Adobe Photoshop CS6的安装包,需要你在Windows系统(或虚拟机)先安装好之后,复制文件至Wine的环境目录中才可以。

2、准备安装

作者准备的是Linux Ubuntu 18.04 Mini版本作为系统,详情见https://help.ubuntu.com/community/Installation/MinimalCD/

准备一个Windows XP或更高版本,安装至虚拟机或实体机,作者这里使用的是深度XP v6.2纯净版,安装至虚拟机中。

准备Adobe Photoshop CS6安装包,文件名为Photoshop_13_LS3.zip,这里不提供下载,网上一搜一大片,推荐使用原版,其他版本概不负责。

虚拟机作者这里使用的是Parallels Destop。

3、开始安装

1、首先安装Windows XP,过程不详述了,安装好之后将Adobe Photoshop安装至XP,然后将以下目录文件打包或复制出来留以备用。

C:\Program Files\Adobe\
C:\Program Files\Common Files\Adobe
C:\Documents and Settings\$USER\Application Data\Adobe

2、安装Linux系统,并安装VMTools或者Parallels Tools。完毕之后,更新系统源,并保持系统为最新状态。

系统源可以使用阿里云的:https://developer.aliyun.com/mirror

更新源

# 先修改root密码
sudo passwd root
# 使用root登录
exit

# 更新源
apt-get update
# 安装vim
apt-get install -y vim
# 修改源
vim /etc/apt/source.list
# 替换源
:%s/cn\.archive\.ubuntu\.com/mirrors.aliyun.com/g
:wq

# 再次更新源,并升级到最新
apt-get update && apt-get upgrade -y

修改编码(为GUI界面的中文不乱码做准备)

# 查看编码
locale -a

# 修改locale.gen,增加编码
vim /etc/locale.gen
# 去掉zh_CN UTF-8 UTF-8前面的注释 并保存
zh_CN UTF-8 UTF-8
:wq

# 生成新的编码
locale-gen

安装字体

# 安装中文支持
apt-get install language-pack-zh-hans language-pack-zh-hans-base -y
# 上面记不住的话以后可以直接搜索也行
apt-cache search zh-hans
apt-cache search language-pack

# 安装中文字体
apt-get install fonts-wqy-microhei -y
# 当然你也可以搜索
apt-cache search zh-cn
apt-cache search ttf

安装桌面环境xfce4,你也可以用别的

# 安装桌面环境 xfce4-goodies是一些xfce的常用软件集合
apt-get install xfce4 xfce4-goodies -y

# 将xinitrc复制到家目录下前面加.
cp /etc/X11/xinit/xinitrc ~/.xinitrc
vim ~/.xinitrc

# 写入语言编码格式,并再最后启动xfce4
LANG=zh_CN.UTF-8
startxfce4 &

# 增加语言编码格式到~/.profile
LANG=zh_CN.UTF-8
# xinitrc xprofile bashrc bashprofile的生效取决于登录方式,要是你/etc/inittab里是设置的是runlevel是3(默认),bashrc会生效的

# 想让xinitrc生效还需要重启

# 重启,当然也可以不重启
# 不重启办法
export LANG=zh_CN.UTF-8
# 或
reboot

# 启动桌面
startx

现在来安装VM-Tools或ParallelsTools,这个不多介绍了,虚拟机的插件而已,安装好了后,重启,至此Linux的桌面环境安装好了。


安装Wine

操作步骤可见文档:https://wiki.winehq.org/Ubuntu_zhcn

# 安装wine
sudo dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo apt-get install software-properties-common
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
sudo apt update
sudo apt install --install-recommends winehq-stable -y

# 安装winetricks
apt-get install winetricks -y
# winetricks需要zenity才可以显示gui
apt-get install zenity -y

设置wine的32位环境

# 写个bash
vim ~/wine32.sh && chmod +x ~/wine32.sh

#!/bin/bash

export WINEARCH=win32 WINEPREFIX=~/.wine32

设置环境

source ~/wine32.sh

设置wine,并安装需要的基础包

# 设置为Windows XP
winecfg


# 安装gecko和mono
# 可使用winetricks全自动从网上下载安装,也可以手动安装

# 手动安装?

# 安装基础包 打开安装面板 命令见:https://wiki.winehq.org/Wine_User%27s_Guide#Basic_usage:_applications_and_control_panel_applets
wine uninstaller

# 选择安装包即可安装完成

# 自动安装直接执行?即可
winetricks

配置winetricks,安装依赖(作)

# 自动安装可以直接使用winetricks选择默认环境勾选必须安装的内容即可
# 手动安装提前把下载好的安装包放到~/.cache/winetricks里面(你备份过即可)
winetricks

# 也可以使用命令安装
winetricks dlls atmlib gdiplus msxml6 vcrun2005 vcrun2008 vcrun2010 corefonts tahoma FontsSmoothRGB

复制XP系统内的Adobe Photoshop到~/.wine32/drive_c/Program Files/root/.wine32/drive_c/Program Files/Common Files//root/.wine32/drive_c/users/root/Application Data/内之后,

# 运行Photoshop,不过现在字体全是框框(注意需要断网打开,因为它会要求你登录试用什么的)
cd '/root/.wine32/drive_c/Program Files/Adobe/Adobe Photoshop CS6'
wine Photoshop.exe

解决乱码

现在来解决乱码问题,

# 打开注册表
wine regedit
# 找到位置
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes

将MS Shell Dlg和MS Shell Dlg2内容替换成文泉驿微米黑这几个字(因为上面已经安装了这个字体),然后重新打开Photoshop

cd '/root/.wine32/drive_c/Program Files/Adobe/Adobe Photoshop CS6'
wine Photoshop.exe

好,现在字体都正常了

image-20200102213516828.png

功能方面都可以使用的。

如果想让字体平滑一些的话,可以修改以下配置:

wine regedit
#进入 HKEY_USERS\S-1-5-21-0-0-0-1000\Control Panel\Desktop
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:0000000

至此结束。

]]>
<![CDATA[VIM简单配置]]> http://codeshif.com/archives/39.html 2019-11-24T03:40:00+08:00 2019-11-24T03:40:00+08:00 admin https://www.codeshif.com " 高亮代码 syntax on " 高亮搜索 set hlsearch " 搜索时同时高亮 set incsearch " 显示行号 set number " 自动缩进空白长度 set shiftwidth=4 " tab等同空格长度 set tabstop=4 " 定义tab键是制表符\t和空格混合,制表符表符\t长度=tabstop长度 " set softtabstop " 改变制表符\t为空格,按tab实际为空格 set expandtab call plug#begin() Plug 'vim-airline/vim-airline' Plug 'scrooloose/nerdtree' Plug 'Yggdroot/indentLine' Plug 'easymotion/vim-easymotion' call plug#end() nmap ss <Plug>(easymotion-prefix) ]]> <![CDATA[让aurman和makepkg在root下载运行]]> http://codeshif.com/archives/38.html 2019-08-24T04:28:00+08:00 2019-08-24T04:28:00+08:00 admin https://www.codeshif.com 1.先修改makepkg

直接贴办法 原文

vim /usr/bin/makepkg

加入asroot

OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
          'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
          'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage'
          'rmdeps' 'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps'
          'verifysource' 'version' 'asroot')

再修改EUID:

if (( ! INFAKEROOT )); then
    if (( EUID == 0 )); then
        error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\catastrophic damage to your system.")" "makepkg"
        #exit 1 # $E_USER_ABORT
 
    fi
fi

2.修改aurman

先搜索一下错误提示的文件再哪

grep -r "Do not run aurman" /usr

再修改源文件

vim /usr/lib/python3.7/site-packages/aurman/main.py

注释os.getuid下面的再加个pass

ef check_privileges() -> None:
    """
    checks the privileges and exists in case of aurman being executed with sudo
    """
    if os.getuid() == 0:
        pass
        #aurman_error("Do not run aurman with sudo")
        #sys.exit(1)

OK

]]>
<![CDATA[ArchLinux GF119 GT620显卡驱动]]> http://codeshif.com/archives/34.html 2019-08-23T01:53:00+08:00 2019-08-23T01:53:00+08:00 admin https://www.codeshif.com 本来默认是有显卡驱动的【nouveau】,感觉不太好用的话就换官方的闭源网卡驱动,
通过这个列表查询型号在里面,

2019-08-23-015450_401x96_scrot.png

显示【The 390.xx driver supports the following set of GPUs.】

然后在搜索一下发现有:

pacman -Ss nvidia-390

结果

extra/nvidia-390xx 390.116-45 [已安装]
    NVIDIA drivers for linux, 390xx legacy branch
extra/nvidia-390xx-dkms 390.116-45
    NVIDIA driver sources for linux, 390xx legacy
    branch
extra/nvidia-390xx-lts 1:390.116-14
    NVIDIA drivers for linux-lts, 390xx legacy branch
extra/nvidia-390xx-settings 390.116-1
    Tool for configuring the NVIDIA graphics driver,
    390xx legacy branch
extra/nvidia-390xx-utils 390.116-1 [已安装]
    NVIDIA drivers utilities
extra/opencl-nvidia-390xx 390.116-1
    OpenCL implemention for NVIDIA

直接安装!

pacman -S nvidia-390xx
nvidia-xconfig

重启

pkill xinit
xinit

或者

reboot

OK

Wiki帮助文档

]]>
<![CDATA[ArchLinux USB无线网卡8192CU上网]]> http://codeshif.com/archives/32.html 2019-08-23T01:38:00+08:00 2019-08-23T01:38:00+08:00 admin https://www.codeshif.com wpa_supplicant制作,详情可以参考ArchLinux Wiki传送

这里说一下简略步骤,首先弄一个文件:

vim /etc/wpa_supplicant/wpa_supplicant.conf

写入:

ctrl_interface=/run/wpa_supplicant
update_config=1

然后开刚,先弄个服务

wpa_supplicant -B -i interface -c /etc/wpa_supplicant/wpa_supplicant.conf

-B是后台运行,-i是指定你的网卡名称,可以用ip link查看,-c是上面wpa配置文件的地址。

完事之后啊,用wpa_cli开始连接:

wpa_cli
scan
scan_result
add_network
set_network 0 ssid "你要连接的无线名称(英文)"
set_network 0 psk "无线密码"
enable_network 0
save_config

保存配置到哪了?到刚才你创建的文件里面了:/etc/wpa_supplicant/wpa_supplicant.conf
然后启动服务:

dhcpcd 你的网卡名

这里注意点啊,如果你在装系统呢,可以在netctl下手,netctl咋弄?

cd /etc/netctl/examples
cp /etc/netctl/examples/wireless-wpa-config ../
vim wireless-wpa-config

将里面的interface的值改成你的网卡名称,然后

netctl enable wireless-wpa-config(配置文件名称)

然后就OK了,和dhcpcd性质差不多,详情看文档。

ArchLinux Wiki网络设置

]]>
<![CDATA[ArchLinux安裝sogou输入法]]> http://codeshif.com/archives/31.html 2019-08-23T01:10:00+08:00 2019-08-23T01:10:00+08:00 admin https://www.codeshif.com 折腾1

现在的AUR上面安装不了sogou输入法不知道为什么,我看帖子这么说:
简书传送门
2019-08-23-010614_650x383_scrot.png

我曹啥玩意啊,行吧,爬了个百度帖子解决了:

贴吧传送门
说有个办法是这样的:

sogoupinyin 更到 2.3.0.0109,加了五笔,依赖qt5,不需要qt4了。但是新版目前没有deb包,不过可以从优麒麟镜像里面提取。
下载 ubuntukylin-19.04-enhanced-amd64.iso(为了一个输入法,下了一个镜像,也是蛮拼的),解压 filesystem.squashfs,打包 /var/lib/dpkg/info/sogoupinyin.list 里的文件(去掉目录)
改一下 aur上的 PKGBUILD,打包安装,测试可用

我没试,看了后面的办法,

2019-08-23-010945_546x184_scrot.png

这个就行了

完整步骤:

sudo pacman -S fcitx-lilydjwg-git fcitx-sogoupinyin

如果是i3-gaps或i3-wm,别忘了加在~/.config/i3/config中:

# fcitx
exec --no-startup-id fcitx

折腾2(继续折腾)

我又去试了试直接安装老版本的东西,
先去aur上面看评论了:

2019-08-24-041435_646x70_scrot.png

那就行了啊,直接开刚,他说加入他的repo,我们就跟着去呗!
AUR搜狗输入法信息他的repo他的博客说明

2019-08-24-041750_593x196_scrot.png

来吧,

vim /etc/pacman.conf

干进去这个:

[xuanrui]
Server = https://arch.xuanruiqi.com/repo/

然后导入这玩意:

pacman-key --recv-keys 6E06FBC8
pacman-key --lsign-key 6E06FBC8

安装,OK

pacman -S fcitx fcitx-im fcitx-sogoupinyin
]]>
<![CDATA[ApacheRewrite修改EvaThumber适应需要的URL]]> http://codeshif.com/archives/26.html 2018-12-27T05:30:00+08:00 2018-12-27T05:30:00+08:00 admin https://www.codeshif.com 如何修改EvaThumber适应需要的URL

EvaThumber的路径方式为:

/thumb/d/image/20181225/1545744945770238,c_200,g_200.jpg

期待的路径为:

/thumb/d/image/20181225/1545744945770238.jpg?200x200

修改办法:

Apache Rewrite:

#/yueyue/20170425/20170425103814_609844_10002_23252.png?200x200_130
#/thumb/d/image/20181225/1545744945770238,c_200,g_200.jpg
RewriteCond %{QUERY_STRING} (\d+)x(\d+)_\d+
RewriteRule ^(thumb\/d\/[^\.]+)(\.\w+) index.php/$1,c_%1,g_%2$2

判断QUERY_STRING最好还是用RewriteCond,然后在RewriteRule里面用%1或%N来表示找到的正则参数。

最后记得在EvaThumber的index.php里面写入这个哦

//  源码是通过PATH_INFO获取的数据的,所以要修改它
$_SERVER['REQUEST_URI'] = '/index.php' . $_SERVER['PATH_INFO'];

当然了,在此之前你要测试URL的话:

RewriteRule (thumb\/d\/[^\.]+)(\.\w+)\?(\d+)x(\d+)_\d+ index.php?ddd=$1,c_$3,g_$4$2 [QSA]

然后建立个index.php

<?php
var_dump($_GET);
]]>
<![CDATA[Ubuntu Apache2开启Rewrite]]> http://codeshif.com/archives/25.html 2018-12-25T19:56:00+08:00 2018-12-25T19:56:00+08:00 admin https://www.codeshif.com 首先执行

a2enmod rewrite

开启rewrite模块,然后编辑文件

/etc/apache2/apache2.conf

找到

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None #这里改成All即可
        Require all granted
</Directory>
AllowOverride All

然后

service apache2 restart
]]>
<![CDATA[Linux常用命令]]> http://codeshif.com/archives/16.html 2018-10-31T06:50:00+08:00 2018-10-31T06:50:00+08:00 admin https://www.codeshif.com 查看磁盘
df -l
fdisk -l

命令历史
dmesg
history
cat /var/log/xxx.log

修改su密码
sudo passwd

设置su可以ssh登录
vi /etc/ssh/sshd_config
PermitRootLogin改为yes

安装xfce4
apt install xfce4 xfce4-goodies
apt install xfce-theme-manager

su命令和su -命令最大的本质区别就是:前者只是切换了root身份,但Shell环境仍然是普通用户的Shell,环境变量没有变;而后者连用户和Shell环境一起切换成root身份了,且环境变量也变成了root用户下的环境变量。su切换成root用户以后,pwd一下,发现工作目录仍然是普通用户的工作目录;而用su -命令切换以后,工作目录变成root的工作目录了。

https://www.cnblogs.com/xd502djj/p/6641475.html

]]>
<![CDATA[Nginx反向代理NodeJS Express 强制HTTP跳转HTTPS]]> http://codeshif.com/archives/12.html 2018-10-25T21:00:00+08:00 2018-10-25T21:00:00+08:00 admin https://www.codeshif.com NodeJS推荐使用PM2进行管理状态,详情了解可以
npm install pm2 -g
pm2 --help
pm2 examples

pm2 start bin/www --name name --watch
--watch是监视文件变化自动reload

重点说说反向代理和跳转HTTPS

UBUNTU系统,所以首先apt install nginx,然后
进入/etc/nginx/sites-available里面新建一个网站配置,例如www.xxx.com
当然了你也可以复制现有default复制一份出来例如cp default www.xxx.com
然后写入并以下信息


# 服务器的HTTP部分
server {
    listen 80;

        # 这里我直接做的反向代理,所以不用写根路径在哪
    #root /var/www/html;

        # 强制从HTTP跳转到HTTPS
    rewrite ^(.*)$  https://$host$1 permanent;

    # 默认的网页名称
    index index.html index.htm index.nginx-debian.html;

        # 网址名称
    server_name xxx.net www.xxx.net;

    location / {
                # 这里就是反向代理的实现了,将访问的网址代理到本地NodeJS中
        proxy_pass  http://127.0.0.1:3000;
        proxy_redirect     off;
                proxy_set_header   Host             $host:$server_port;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
}

# 服务器的HTTPS本分
server {
    listen 443;
        # 默认首页没啥好说的
    index index.html index.htm index.nginx-debian.html;

        # 你的SSL信息,百度一下全是了
    ssl on;
    ssl_certificate   /etc/nginx/cert/215077960110430.pem;
    ssl_certificate_key  /etc/nginx/cert/215077960110430.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

        # HTTPS也要反向代理哦!
    location / {
        proxy_pass  http://127.0.0.1:3000;
        proxy_redirect     off;
                proxy_set_header   Host             $host:$server_port;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
}

哦了,代码就是这么简单,
nginx -t检查一下配置有没有错,service nginx reload加载一下,刷新网页查看结果吧!

]]>