2017. 2. 24. 12:39

어떤 현업께서 IIS가 자동으로 설치가 가능하냐고 물었다. (다 되는건 아니니까 난 안된다고 했다. ㅋㅋ)

OS의 지원 여부에 따라서 command line 또는 powershell로 설치가 가능 할 것 같다. 이 기능을 이용하여 OS가 부팅되면 IIS의 설치여부를 비교하여 설치 명령어를 실행시키면 되지 않을까 하는게 본 필자의 생각이다.


1) 필자는 C# 을 주로 다루는 개발자이므로 아래의 코드와 같이 레지스트리를 비교하여 IIS설치여부를 비교한다.

private static bool IsIisInstalled() => Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp", "VersionString", null) != null;

※ HKLM\Software\Microsoft\InetStp\MajorVersion 레지스트리를 통해 설치버전도 비교 가능



2) command에서 사용할 수 있는 설치명령어로 IIS를 설치한다.

pkgmgr은 deprecated 되었다고 해서 DISM을 사용하라고 하는데 내 OS(Windows 10)에서는 설치가 가능했다.

다른 OS버전에서는 사용이 가능한지는 해당 OS에서 적용해봐야지 알 수 있을 것 같다.


일반권한으로 실행해도 가능

c:\> start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-NetFxExtensibility45;IIS-ASPNET45;NetFx4Extended-ASPNET45;IIS-NetFxExtensibility;IIS-ASPNET;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-RequestMonitor;IIS-Security;IIS-RequestFiltering;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;IIS-ManagementConsole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI


관리자권한으로 실행

c:\> START /WAIT DISM /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASP /FeatureName:IIS-ASPNET /FeatureName:IIS-ASPNET45 /FeatureName:IIS-BasicAuthentication /FeatureName:IIS-CGI /FeatureName:IIS-ClientCertificateMappingAuthentication /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-CustomLogging /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DigestAuthentication /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-FTPExtensibility /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-HostableWebCore /FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-HttpErrors /FeatureName:IIS-HttpLogging /FeatureName:IIS-HttpRedirect /FeatureName:IIS-HttpTracing /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-IISCertificateMappingAuthentication /FeatureName:IIS-IPSecurity /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-LegacyScripts /FeatureName:IIS-LegacySnapIn /FeatureName:IIS-LoggingLibraries /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-NetFxExtensibility45 /FeatureName:IIS-ODBCLogging /FeatureName:IIS-Performance /FeatureName:IIS-RequestFiltering /FeatureName:IIS-RequestMonitor /FeatureName:IIS-Security /FeatureName:IIS-ServerSideIncludes /FeatureName:IIS-StaticContent /FeatureName:IIS-URLAuthorization /FeatureName:IIS-WebDAV /FeatureName:IIS-WebServer /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-WebServerRole /FeatureName:IIS-WindowsAuthentication /FeatureName:IIS-WMICompatibility /FeatureName:WAS-ConfigurationAPI /FeatureName:WAS-NetFxEnvironment /FeatureName:WAS-ProcessModel /FeatureName:WAS-WindowsActivationService


※ 이외에 다른방법은 분명히 있을 것이 분명하므로 이것만이 정답은 아님을 말씀드립니다.


참고:

http://stackoverflow.com/questions/37846864/how-to-know-iis-installed-or-not-programmatically

http://stackoverflow.com/questions/32097336/programmatically-enable-install-iis

Posted by CoolDragon
2016. 11. 2. 15:09

A few years ago, I tried to set up Jenkins on Windows server for projects written in c#. However, I've almost forgotten to use them. So I am going to build a deployment system that uses Git and Jenkins.


Step)

- [Jenkins] Installation on Window

- [Jenkins] Configuration

- [Jenkins] Build source code

- [Jenkins] Deployment


Here's the first step.


1) Download

https://jenkins.io/

When you unzip the downloaded file, there is an install file named "jenkins.msi".


2) Install

2.1) Wizard

You'd better change install directory that does not include space.


2.2) Jenkins

After installation, a web browser shows up and, keep setting basic configurations of Jenkins.

Customize Jenkins

- Install suggested plugins: automatically install plugins

- Select plugins to install: manually install plugins


Completed install of Jenkins

If you want to change the basic port(8080), it can be changed to "C:\Jenkins\jenkins.xml" file, and Jenkins service must restart.


※ If you want to use git, install git on the same server.

Posted by CoolDragon
2015. 9. 2. 22:21

잡설

항상 마이크로소프트의 제품군들만 사용해오다 보니 리눅스를 다루는 것은 가슴속 한켠엔 '어려운 것'으로 자리잡고 있었다. 지금이라도 이렇게 시간이 될 때 한가지 한가지 해보고 정리를 해다가 보면 '어려운 것' 에서 '해볼만 한 것'으로 바뀌지 않을까 싶다.


Install FTP

# sudo apt-get install vsftpd


Create User for FTP

$ sudo -i # root 변경

# 예) useradd -d {home directly} -u {user id}

useradd -d /opt/lampp/htdocs/wordpress/wp-content/themes/ -u themes #  FTP접속 시 '/home/cooldragon'가 홈디렉토리

$ passwd themes # 비밀번호 설정

Enter new UNIX password: 

Retype new UNIX password: 

$chmod 777 themes/ # 계정에 대한 쓰기 읽기 권한이 없다면 권한을 부여


FTP Configuration

$ vi /etc/vsftpd.conf

# Allow anonymous FTP? (Disabled by default)

anonymous_enable=NO


# Uncomment this to allow local users to log in.

local_enable=YES


# Uncomment this to enable any form of FTP write command.

write_enable=YES


# Default umask for local users is 077. You may wish to change this to 022,

# if your users expect that (022 is used by most other ftpd's)

local_umask=0

$ service vsftpd restart


Access Test

Now you can drag file and drop it into the directory.


후기

사실 FTP를 설치한 이유가 wordpress에서 Themes을 다운로드 FTP를 통하여 자동 업데이트 되도록 하기 위함이었는데.. virtualbox로 생성한 거라 내부IP와 상관이 있는것인지.. 모르겠지만 계속 실패가 났다. 결국 ftp client로 접속하여 다운로드 받은 파일을 드래그&드랍으로 파일을 붙여 넣었다.

깊이 없는 리눅스 겉핥기와 같은 나의 수준이 문제겠지.... 방법이 뭔가요?

Posted by CoolDragon
2015. 8. 31. 01:16

1. Install PostgreSql

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

$ sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.4" >> pgdg.list

$ sudo cp pgdg.list /etc/apt/sources.list.d/pgdg.list

$ sudo apt-get update

$ sudo apt-get -y install postgresql-9.4 postgresql-client-9.4


2. Set password for Postgresql

$ sudo -u postgres psql postgres

postgres=# \password postgres

Enter new password: 

Enter it again: 

postgres=# \q


3. Allow aceess remote

$ sudo vi /etc/postgresql/9.4/main/pg_hba.conf

...

# IPv4 local connections:

host    all             all             127.0.0.1/32            md5

host    all             all             192.168.1.0/24          md5   # Add 

...

$ sudo vi /etc/postgresql/9.4/main/postgresql.conf

listen_addresses = '*' # replace "*" with "localhost"

port = 5432

$ sudo service postgresql restart


4. Open Port on firewall

$ sudo ufw allow 5432


5. Test

pgAdmin Download








Reference

http://www.unixmen.com/install-postgresql-9-4-phppgadmin-ubuntu-14-10/

http://askubuntu.com/questions/233064/why-am-i-getting-command-deb-not-found


Posted by CoolDragon
2015. 8. 27. 18:02


$ sudo dpkg -i "YourDebPackage.deb"


Posted by CoolDragon
2015. 7. 18. 05:50

1. install NPM

> sudo apt-get install npm

> sudo npm update -g npm


2.install CLI

> sudo npm install -g grunt-cli


3. Create Gruntfile

> npm init # 명령어 실행 후 "package.json" 파일이 생성되고 "name" : "프로젝트명"이  "grunt"일 경우 다른 프로젝트명으로 변경한다.

> npm install grunt --save-dev

npm install grunt-contrib-concat --save-dev # concat 플러그인 설치 (여러 파일을 하나의 파일로 만들어준다)

> npm install grunt-contrib-watch --save-dev # watch 플러그인 설치(설정된 파일을 모니터링하여 변경사항이 있으면 바로 적용시켜준다)

> touch gruntfile.js

Grunt 주요 플러그인

  - uglify : JS 파일 병합 및 압축

  - concat : JS 파일 병합 

  - less, sass : less 또는 sass 파일을 css로 변환(?)

  - cssmin : css 파일 압축

  - imagemin : 이미지 파일 사이즈 감소


4. gruntfile.js Setting

module. exports = function(grunt) {


grunt.initConfig({

  concat: {

    js: {

      src: ['script/js1.js', 'script/js2.js', 'script/js3.js'],

      dest: 'dist/js/built.js',

    },

    css: {

      src: ['css/intro.js', 'css/project.js', 'css/outro.js'],

      dest: 'dist/css/built.js',

    },

  },

  watch: {

    scripts: {

      files: ['script/**/*.js'],

      tasks: ['concat:js'],

    },

    css: {

      files: ['css/**/*.css'],

      tasks: ['concat:css'],

    },

  },

});


grunt.loadNpmTasks('grunt-contrib-concat');

grunt.loadNpmTasks('grunt-contrib-watch');


grunt.registerTask('default', ['concat', 'watch']);

}


5. Execute

> grunt {TaskName}

> grunt

grunt.registerTask()의 첫번째 인자에 'default'로 지정하면 grunt 명령어 실행시 옵션 없이 두번째 인자 배열안의 항목들을 실행할 수 있다.

Posted by CoolDragon