CODESHIF - Linux https://www.codeshif.com/category/linux/ Linux技巧 Linux Ubuntu Wine Photoshop CS6 https://www.codeshif.com/archives/41.html 2020-01-02T21:59:00+08:00 Linux Ubuntu Wine Photoshop CS61、注意事项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\Adobe2、安装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内容替换成文泉驿微米黑这几个字(因为上面已经安装了这个字体),然后重新打开Photoshopcd '/root/.wine32/drive_c/Program Files/Adobe/Adobe Photoshop CS6' wine Photoshop.exe好,现在字体都正常了功能方面都可以使用的。如果想让字体平滑一些的话,可以修改以下配置: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至此结束。 VIM简单配置 https://www.codeshif.com/archives/39.html 2019-11-24T03:40:00+08:00 " 高亮代码 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) 让aurman和makepkg在root下载运行 https://www.codeshif.com/archives/38.html 2019-08-24T04:28:00+08:00 1.先修改makepkg直接贴办法 原文vim /usr/bin/makepkg加入asrootOPT_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 fi2.修改aurman先搜索一下错误提示的文件再哪grep -r "Do not run aurman" /usr再修改源文件vim /usr/lib/python3.7/site-packages/aurman/main.py注释os.getuid下面的再加个passef 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 ArchLinux GF119 GT620显卡驱动 https://www.codeshif.com/archives/34.html 2019-08-23T01:53:00+08:00 本来默认是有显卡驱动的【nouveau】,感觉不太好用的话就换官方的闭源网卡驱动,通过这个列表查询型号在里面,显示【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或者rebootOKWiki帮助文档 ArchLinux USB无线网卡8192CU上网 https://www.codeshif.com/archives/32.html 2019-08-23T01:38:00+08:00 用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网络设置 ArchLinux安裝sogou输入法 https://www.codeshif.com/archives/31.html 2019-08-23T01:10:00+08:00 折腾1现在的AUR上面安装不了sogou输入法不知道为什么,我看帖子这么说:简书传送门我曹啥玩意啊,行吧,爬了个百度帖子解决了:贴吧传送门说有个办法是这样的:sogoupinyin 更到 2.3.0.0109,加了五笔,依赖qt5,不需要qt4了。但是新版目前没有deb包,不过可以从优麒麟镜像里面提取。 下载 ubuntukylin-19.04-enhanced-amd64.iso(为了一个输入法,下了一个镜像,也是蛮拼的),解压 filesystem.squashfs,打包 /var/lib/dpkg/info/sogoupinyin.list 里的文件(去掉目录) 改一下 aur上的 PKGBUILD,打包安装,测试可用我没试,看了后面的办法,这个就行了完整步骤:sudo pacman -S fcitx-lilydjwg-git fcitx-sogoupinyin如果是i3-gaps或i3-wm,别忘了加在~/.config/i3/config中:# fcitx exec --no-startup-id fcitx折腾2(继续折腾)我又去试了试直接安装老版本的东西,先去aur上面看评论了:那就行了啊,直接开刚,他说加入他的repo,我们就跟着去呗!AUR搜狗输入法信息和他的repo和他的博客说明来吧,vim /etc/pacman.conf干进去这个:[xuanrui] Server = https://arch.xuanruiqi.com/repo/然后导入这玩意:pacman-key --recv-keys 6E06FBC8 pacman-key --lsign-key 6E06FBC8安装,OKpacman -S fcitx fcitx-im fcitx-sogoupinyin ApacheRewrite修改EvaThumber适应需要的URL https://www.codeshif.com/archives/26.html 2018-12-27T05:30:00+08:00 如何修改EvaThumber适应需要的URLEvaThumber的路径方式为:/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); Ubuntu Apache2开启Rewrite https://www.codeshif.com/archives/25.html 2018-12-25T19:56:00+08:00 首先执行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 Linux常用命令 https://www.codeshif.com/archives/16.html 2018-10-31T06:50:00+08:00 查看磁盘df -lfdisk -l命令历史dmesghistorycat /var/log/xxx.log修改su密码sudo passwd设置su可以ssh登录vi /etc/ssh/sshd_config将PermitRootLogin改为yes安装xfce4apt install xfce4 xfce4-goodiesapt install xfce-theme-managersu命令和su -命令最大的本质区别就是:前者只是切换了root身份,但Shell环境仍然是普通用户的Shell,环境变量没有变;而后者连用户和Shell环境一起切换成root身份了,且环境变量也变成了root用户下的环境变量。su切换成root用户以后,pwd一下,发现工作目录仍然是普通用户的工作目录;而用su -命令切换以后,工作目录变成root的工作目录了。https://www.cnblogs.com/xd502djj/p/6641475.html Nginx反向代理NodeJS Express 强制HTTP跳转HTTPS https://www.codeshif.com/archives/12.html 2018-10-25T21:00:00+08:00 NodeJS推荐使用PM2进行管理状态,详情了解可以npm install pm2 -gpm2 --helppm2 examplespm2 start bin/www --name name --watch--watch是监视文件变化自动reload重点说说反向代理和跳转HTTPSUBUNTU系统,所以首先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加载一下,刷新网页查看结果吧!